mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(logger): fixed logger to show prod server-side logs (#1027)
This commit is contained in:
@@ -44,7 +44,7 @@ const LOG_CONFIG = {
|
||||
colorize: true,
|
||||
},
|
||||
production: {
|
||||
enabled: typeof window === 'undefined', // Enable only on server-side in production
|
||||
enabled: true, // Will be checked at runtime
|
||||
minLevel: LogLevel.ERROR,
|
||||
colorize: false,
|
||||
},
|
||||
@@ -106,6 +106,11 @@ export class Logger {
|
||||
private shouldLog(level: LogLevel): boolean {
|
||||
if (!config.enabled) return false
|
||||
|
||||
// In production, only log on server-side (where window is undefined)
|
||||
if (ENV === 'production' && typeof window !== 'undefined') {
|
||||
return false
|
||||
}
|
||||
|
||||
const levels = [LogLevel.DEBUG, LogLevel.INFO, LogLevel.WARN, LogLevel.ERROR]
|
||||
const minLevelIndex = levels.indexOf(config.minLevel)
|
||||
const currentLevelIndex = levels.indexOf(level)
|
||||
|
||||
Reference in New Issue
Block a user