MCPcopy Index your code
hub / github.com/simstudioai/sim / shouldLog

Method shouldLog

packages/logger/src/index.ts:200–212  ·  view source on GitHub ↗

* Determines if a log at the given level should be displayed

(level: LogLevel)

Source from the content-addressed store, hash-verified

198 * Determines if a log at the given level should be displayed
199 */
200 private shouldLog(level: LogLevel): boolean {
201 if (!this.config.enabled) return false
202
203 if (getNodeEnv() === 'production' && typeof window !== 'undefined') {
204 return false
205 }
206
207 const levels = [LogLevel.DEBUG, LogLevel.INFO, LogLevel.WARN, LogLevel.ERROR]
208 const minLevelIndex = levels.indexOf(this.config.minLevel)
209 const currentLevelIndex = levels.indexOf(level)
210
211 return currentLevelIndex >= minLevelIndex
212 }
213
214 /**
215 * Format arguments for logging, converting objects to JSON strings

Callers 1

logMethod · 0.95

Calls 1

getNodeEnvFunction · 0.85

Tested by

no test coverage detected