src/config/config-initialiser.js
function handleLogger (config) {
  const configOptions = (config.logger || {}).options
  let Logger
  if (config.logger == null || config.logger.name === 'default') {
    Logger = DefaultLogger
  } else {
    Logger = resolvePluginClass(config.logger, 'logger')
  }

  if (configOptions instanceof Array) {
    // Note: This will not work on options without filename, and
    // is biased against for the winston logger
    let options
    for (let i = 0; i < configOptions.length; i++) {
      options = configOptions[i].options
      if (options && options.filename) {
        options.filename = fileUtils.lookupConfRequirePath(options.filename)
      }
    }
  }

  config.logger = new Logger(configOptions)
  if (!config.logger.info) {
    config.logger.debug = config.logger.log.bind(config.logger, C.LOG_LEVEL.DEBUG)
    config.logger.info = config.logger.log.bind(config.logger, C.LOG_LEVEL.INFO)
    config.logger.warn = config.logger.log.bind(config.logger, C.LOG_LEVEL.WARN)
    config.logger.error = config.logger.log.bind(config.logger, C.LOG_LEVEL.ERROR)
  }
  if (LOG_LEVEL_KEYS.indexOf(config.logLevel) !== -1) {
    // NOTE: config.logLevel has highest priority, compare to the level defined
    // in the nested logger object
    config.logLevel = C.LOG_LEVEL[config.logLevel]
    config.logger.setLogLevel(config.logLevel)
  }
}
function handleLogger (config) {
  const configOptions = (config.logger || {}).options
  let Logger
  if (config.logger == null || config.logger.name === 'default') {
    Logger = DefaultLogger
  } else {
    Logger = resolvePluginClass(config.logger, 'logger')
  }

  if (configOptions instanceof Array) {
    // Note: This will not work on options without filename, and
    // is biased against for the winston logger
    let options
    for (let i = 0; i < configOptions.length; i++) {
      options = configOptions[i].options
      if (options && options.filename) {
        options.filename = fileUtils.lookupConfRequirePath(options.filename)
      }
    }
  }

  config.logger = new Logger(configOptions)
  if (!config.logger.info) {
    config.logger.debug = config.logger.log.bind(config.logger, C.LOG_LEVEL.DEBUG)
    config.logger.info = config.logger.log.bind(config.logger, C.LOG_LEVEL.INFO)
    config.logger.warn = config.logger.log.bind(config.logger, C.LOG_LEVEL.WARN)
    config.logger.error = config.logger.log.bind(config.logger, C.LOG_LEVEL.ERROR)
  }
  if (LOG_LEVEL_KEYS.indexOf(config.logLevel) !== -1) {
    // NOTE: config.logLevel has highest priority, compare to the level defined
    // in the nested logger object
    config.logLevel = C.LOG_LEVEL[config.logLevel]
    config.logger.setLogLevel(config.logLevel)
  }
}
function handleLogger ( config ) { const configOptions = ( config . logger || { } ) . options let Logger if ( config . logger == null || config . logger . name === 'default' ) { Logger = DefaultLogger } else { Logger = resolvePluginClass ( config . logger , 'logger' ) } if ( configOptions instanceof Array ) { // Note: This will not work on options without filename, and // is biased against for the winston logger let options for ( let i = 0 ; i < configOptions . length ; i ++ ) { options = configOptions [ i ] . options if ( options && options . filename ) { options . filename = fileUtils . lookupConfRequirePath ( options . filename ) } } } config . logger = new Logger ( configOptions ) if ( ! config . logger . info ) { config . logger . debug = config . logger . log . bind ( config . logger , C . LOG_LEVEL . DEBUG ) config . logger . info = config . logger . log . bind ( config . logger , C . LOG_LEVEL . INFO ) config . logger . warn = config . logger . log . bind ( config . logger , C . LOG_LEVEL . WARN ) config . logger . error = config . logger . log . bind ( config . logger , C . LOG_LEVEL . ERROR ) } if ( LOG_LEVEL_KEYS . indexOf ( config . logLevel ) !== - 1 ) { // NOTE: config.logLevel has highest priority, compare to the level defined // in the nested logger object config . logLevel = C . LOG_LEVEL [ config . logLevel ] config . logger . setLogLevel ( config . logLevel ) } }
Initialize the logger and overwrite the root logLevel if it's set
CLI arguments will be considered.

@param {Object} config deepstream configuration object

@private
@returns {void}
Initialize the logger and overwrite the root logLevel if it s set CLI arguments will be considered .