()
| 1 | type LogLevel = 'debug' | 'info' | 'warn' | 'error' |
| 2 | |
| 3 | const getLogLevel = (): LogLevel => { |
| 4 | if (typeof window !== 'undefined') { |
| 5 | const logLevel = localStorage.getItem('logLevel') as LogLevel |
| 6 | if (logLevel && ['debug', 'info', 'warn', 'error'].includes(logLevel)) { |
| 7 | return logLevel |
| 8 | } |
| 9 | } |
| 10 | |
| 11 | // Default to 'warn' in production, 'debug' in development |
| 12 | return process.env.NODE_ENV === 'production' ? 'warn' : 'debug' |
| 13 | } |
| 14 | |
| 15 | const shouldLog = (level: LogLevel, currentLevel: LogLevel): boolean => { |
| 16 | const levels = ['debug', 'info', 'warn', 'error'] |
no outgoing calls
no test coverage detected