Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setLogLevel(level: LogLevel | string) {
level = coerceLogLevel(level)
if (!isValidEnum(LogLevel, level) || level === undefined) {
this.logLevel = LogLevel.ERROR
} else {
this.logLevel = level
}
}
constructor(config: ConsoleLogHandlerConfig = {}) {
this.logLevel = LogLevel.NOTSET
if (config.logLevel !== undefined && isValidEnum(LogLevel, config.logLevel)) {
this.setLogLevel(config.logLevel)
}
this.logToConsole = config.logToConsole !== undefined ? !!config.logToConsole : true
this.prefix = config.prefix !== undefined ? config.prefix : '[OPTIMIZELY]'
}