MCPcopy Create free account
hub / github.com/alanagoyal/docbase / getLogLevel

Function getLogLevel

lib/client-logger.ts:3–13  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1type LogLevel = 'debug' | 'info' | 'warn' | 'error'
2
3const 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
15const shouldLog = (level: LogLevel, currentLevel: LogLevel): boolean => {
16 const levels = ['debug', 'info', 'warn', 'error']

Callers 1

createClientLoggerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected