How to use the @optimizely/js-sdk-utils.isValidEnum function in @optimizely/js-sdk-utils

To help you get started, we’ve selected a few @optimizely/js-sdk-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github optimizely / javascript-sdk / packages / logging / src / logger.ts View on Github external
setLogLevel(level: LogLevel | string) {
    level = coerceLogLevel(level)
    if (!isValidEnum(LogLevel, level) || level === undefined) {
      this.logLevel = LogLevel.ERROR
    } else {
      this.logLevel = level
    }
  }
github optimizely / javascript-sdk / packages / logging / src / logger.ts View on Github external
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]'
  }