mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:51:13 -05:00
29 lines
694 B
TypeScript
29 lines
694 B
TypeScript
/**
|
|
* Logger Utility
|
|
*
|
|
* Provides conditional logging based on environment.
|
|
* Prevents console noise in production builds.
|
|
*/
|
|
|
|
const isDev = import.meta.env.DEV;
|
|
|
|
type LogContext = Record<string, unknown>;
|
|
|
|
export const logger = {
|
|
log: (...args: unknown[]): void => {
|
|
if (isDev) console.log(...args);
|
|
},
|
|
error: (message: string, context?: LogContext): void => {
|
|
console.error(message, context); // Always log errors
|
|
},
|
|
warn: (...args: unknown[]): void => {
|
|
if (isDev) console.warn(...args);
|
|
},
|
|
info: (...args: unknown[]): void => {
|
|
if (isDev) console.info(...args);
|
|
},
|
|
debug: (...args: unknown[]): void => {
|
|
if (isDev) console.debug(...args);
|
|
}
|
|
};
|