mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 10:31:13 -05:00
Refactor code structure and remove redundant changes
This commit is contained in:
49
src-old/lib/logger.ts
Normal file
49
src-old/lib/logger.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* 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);
|
||||
},
|
||||
// Performance monitoring
|
||||
performance: (component: string, duration: number): void => {
|
||||
if (isDev) {
|
||||
console.log(`⚡ ${component} rendered in ${duration}ms`, {
|
||||
component,
|
||||
duration,
|
||||
category: 'performance',
|
||||
});
|
||||
}
|
||||
},
|
||||
// Moderation action tracking
|
||||
moderationAction: (action: string, itemId: string, duration: number): void => {
|
||||
if (isDev) {
|
||||
console.log(`🎯 Moderation action: ${action}`, {
|
||||
action,
|
||||
itemId,
|
||||
duration,
|
||||
category: 'moderation',
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user