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

Function getLogLevel

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

Source from the content-addressed store, hash-verified

1type LogLevel = 'debug' | 'info' | 'warn' | 'error'
2
3const getLogLevel = (): LogLevel => {
4 const logLevel = process.env.LOG_LEVEL as LogLevel
5 if (logLevel && ['debug', 'info', 'warn', 'error'].includes(logLevel)) {
6 return logLevel
7 }
8
9 switch (process.env.NODE_ENV) {
10 case 'production':
11 return 'warn'
12 case 'test':
13 return 'error'
14 default:
15 return 'debug'
16 }
17}
18
19const shouldLog = (level: LogLevel): boolean => {
20 const levels = ['debug', 'info', 'warn', 'error']

Callers 1

shouldLogFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected