Instantiate winston logger.

@param {string=} opt_level .
@param {string=} opt_dir .
@return {winston.Logger} .
11630
function createLogger(opt_level, opt_dir) {
  var config = getLogConfig(opt_level, opt_dir);
  var transports = getTransports(config);

  // check logdir
  if (!fs.existsSync(config.file.dir)) {
    throw new Error(
      util.format('The logdir does not exist: %s', config.file.dir));
  }

  // create instance
  var logger = new (winston.Logger)({
    transports: [
      new winston.transports.Console(transports.console),
      new winston.transports.File(transports.file)
    ],
    exitOnError: false,
    exceptionHandlers: [
      new winston.transports.File(transports.error)
    ]
  });

  // use syslog's levels
  logger.setLevels(winston.config.syslog.levels);

  // if production env, remove console logger
  if (process.env.NODE_ENV === 'production') {
    logger.remove(winston.transports.Console);
  }

  return logger;
}
400785
def logger(logger, level = :info, format = :apache)
      default_options[:logger]     = logger
      default_options[:log_level]  = level
      default_options[:log_format] = format
    end
122251
function Uploader( opts ) {
            this.options = $.extend( true, {}, Uploader.options, opts );
            this._init( this.options );
        }
624933
function RaspiCam( opts ) {
  
  if ( !(this instanceof RaspiCam) ) {
    return new RaspiCam( opts );
  }

  // Ensure opts is an object
  opts = opts || {};

  if(typeof opts.mode === "undefined" || typeof opts.output === "undefined"){
    console.log("Error: RaspiCam: must define mode and output");
    return false;
  }

  // Initialize this Board instance with
  // param specified properties.
  this.opts = {};
  _.assign( this.opts, opts );

  // If any opts use the abbreviation, convert to
  // the full word (eg. from opts.w to opts.width)
  this.hashOpts( opts );

  // Set up opts defaults
  this.defaultOpts( );

  // Create derivative opts
  this.derivativeOpts( );

  // If this.filepath doesn't exist, make it
  this.createFilepath( );
  
  //child process
  this.child_process = null;

  //directory watcher
  this.watcher = null;

  //events.EventEmitter.call(this);
}
932489
def __gen_opts(self, opts_in, grains, saltenv=None, ext=None, pillarenv=None):
        '''
        
        '''
        opts = copy.deepcopy(opts_in)
        opts['file_client'] = 'local'
        if not grains:
            opts['grains'] = {}
        else:
            opts['grains'] = grains
        # Allow minion/CLI saltenv/pillarenv to take precedence over master
        opts['saltenv'] = saltenv \
            if saltenv is not None \
            else opts.get('saltenv')
        opts['pillarenv'] = pillarenv \
            if pillarenv is not None \
            else opts.get('pillarenv')
        opts['id'] = self.minion_id
        if opts['state_top'].startswith('salt://'):
            opts['state_top'] = opts['state_top']
        elif opts['state_top'].startswith('/'):
            opts['state_top'] = salt.utils.url.create(opts['state_top'][1:])
        else:
            opts['state_top'] = salt.utils.url.create(opts['state_top'])
        if self.ext and self.__valid_on_demand_ext_pillar(opts):
            if 'ext_pillar' in opts:
                opts['ext_pillar'].append(self.ext)
            else:
                opts['ext_pillar'] = [self.ext]
        if '__env__' in opts['pillar_roots']:
            env = opts.get('pillarenv') or opts.get('saltenv') or 'base'
            if env not in opts['pillar_roots']:
                log.debug("pillar environment '%s' maps to __env__ pillar_roots directory", env)
                opts['pillar_roots'][env] = opts['pillar_roots'].pop('__env__')
            else:
                log.debug("pillar_roots __env__ ignored (environment '%s' found in pillar_roots)",
                          env)
                opts['pillar_roots'].pop('__env__')
        return opts
888749
def init_logger
      log = Log4r::Logger.new(STANDARD_LOGGER)
      log.trunc = true

      # sanity checks since we defined log4r's dynamic levels statically
      unless (Log4r::DEBUG == DEBUG) &&
             (Log4r::INFO == INFO) &&
             (Log4r::WARN == WARN) &&
             (Log4r::ERROR == ERROR) &&
             (Log4r::FATAL == FATAL)
        raise "Logger levels do not match Log4r levels, levels may have been customized"
      end

      Log4r::Logger[STANDARD_LOGGER].level = WARN
      Log4r::Logger[STANDARD_LOGGER].trace = true

      Log4r::StderrOutputter.new :console
      Log4r::Outputter[:console].formatter = Log4r::PatternFormatter.new(:pattern => "[%l] %m")
      log.add(:console)
    end
314349
function (opts) {
	this.env = opts.env;
	this.app = opts.app;
	this.jsonP = opts.jsonP;
	_(this).bindAll('errResponse', 'printError', 'productionLogging', 'devLogging', 'log');
}
70516
function Logger () {
  const levels = [
    'fatal', // 1
    'error', // 2
    'warn', // 3
    'info', // 4
    'debug' // 5
  ];
  let verbosity = 3;

  levels.forEach((level, idx) => {
    this[level] = (...params) => {
      if (idx + 1 <= verbosity) console.log(...params); // eslint-disable-line
    };
  });

  this.setLevel = (_) => {
    verbosity = _;
  };

  return this;
}
942000
function createDefaultLogger(options) {
	const ConsoleLogger = require('./console'),
		consoleLogger = new ConsoleLogger(options),
		config = _.mergeWith({
			name: 'logger',
			streams: [
				{
					level: options && options.level || 'trace',
					type: 'raw',
					stream: consoleLogger
				}
			]
		}, options, function (a, b) {
			return _.isArray(a) ? a.concat(b) : undefined;
		});

	consoleLogger.level = bunyan.resolveLevel(options && options.level || 'trace');

	// default is to add the problem logger
	if (!options || options.problemLogger || options.problemLogger === undefined) {
		const ProblemLogger = require('./problem');
		config.streams.push({
			level: 'trace',
			type: 'raw',
			stream: new ProblemLogger(options)
		});
	}

	const defaultLogger = bunyan.createLogger(config);
	/**
	 * Set log level
	 * Backward compatible with Arrow Cloud MVC framework
	 * @param {Object} nameOrNum log level in string or number
	 * @return {String}
	 */
	defaultLogger.setLevel = function (nameOrNum) {
		var level = 'trace';
		try {
			level = bunyan.resolveLevel(nameOrNum);
		} catch (e) {} // eslint-disable-line no-empty
		consoleLogger.level = level;
		return this.level(level);
	};
	return defaultLogger;
}
16545
function defaults(opts) {
  opts = opts || {}

  if (!opts.streamer) {
    throw new Error('No streamer found. Must pass a streamer to multipart-pipe')
  }

  opts.limit = opts.limit === undefined ? '128mb' : opts.limit;
  opts.limit = typeof opts.limit === 'string' ? parseBytes(opts.limit) : opts.limit;
  opts.allow = opts.allow instanceof RegExp ? opts.allow : new RegExp(opts.allow || '.*');

  if (!opts.filename || typeof opts.filename !== 'function') {
    opts.filename = function (filename, mime) { return filename; };
  }

  return opts
}
477193
function Logger(level, opts) {
	if (!(this instanceof Logger)) return new Logger(level)

	var addTimestamp, name

	if (typeof(level) === 'object') {
		opts = level
		level = opts.level		
	}

	if (typeof(opts) === 'object') {
		addTimestamp = opts.addTimestamp
		name = opts.name
	} else {
		addTimestamp = opts
	}

	if (addTimestamp === undefined)
		addTimestamp = true

	if (name) 
		this.name = '[' + name + '] '
	else 
		this.name = ''

	level = level || LogLevel.INFO
	this.outputs = []
	this.setLevel(level)
	this.addOutput(Logger.consoleLogOutput, addTimestamp)
}
168795
function Logger(moduletag) {
  const trimmedModule = trim(moduletag)
  winston.loggers.add(trimmedModule, {
    console: {
      colorize: true,
      label   : trimmedModule
    }
  })
  const logger = winston.loggers.get(trimmedModule)
  const defs = genericLog(logger, trimmedModule)
  defs.warn = genericLog(logger, trimmedModule, 'warn')
  defs.error = genericLog(logger, trimmedModule, 'error')
  defs.debug = genericLog(logger, trimmedModule, 'debug')
  defs.info = genericLog(logger, trimmedModule, 'info')
  return defs
}
964374
def _setup( name, opts = {} )
      @name      = name
      @parent    = opts.fetch(:parent, nil)
      @appenders = opts.fetch(:appenders, [])
      @additive  = opts.fetch(:additive, true)
      @level     = opts.fetch(:level, nil)

      @caller_tracing = opts.fetch(:caller_tracing, false)

      ::Logging::Logger.define_log_methods(self)
    end
525749
function(options, opt_fileList, opt_dirList) {

  var cmd = '';

  // Detect if the tool file is a python script. If so we need to
  // prefix the exec command with 'python'.
  if (stringEndsWith(options.toolFile, '.py')) {
    cmd += 'python ';
  }

  // Normalize the folder path and join the tool file.
  cmd += path.join(path.resolve(options.closureLinterPath), options.toolFile) + ' ';

  // Set command flags
  cmd += (options.strict) ? '--strict ' : '';
  cmd += (options.maxLineLength) ? '--max_line_length ' + options.maxLineLength + ' ' : '';

  // Finally add files to be linted
  if (opt_dirList && opt_dirList.length > 0) {
    cmd += opt_dirList.map(function(value) {return '-r ' + value;}).join(' ') + ' ';
  }

  if (opt_fileList && opt_fileList.length > 0) {
    cmd += opt_fileList.join(' ');
  }

  return cmd;
}
501840
def get_settings
      warning_opts = get_warning_options
      Trollop::options do
        banner 'LASER: Lexically- and Semantically-Enriched Ruby'
        opt :fix, 'Should errors be fixed in-line?', short: '-f'
        opt :display, 'Should errors be displayed?', short: '-b', default: true
        opt :'report-fixed', 'Should fixed errors be reported anyway?', short: '-r'
        opt :'line-length', 'Warn at the given line length', short: '-l', type: :int
        opt :only, 'Only consider the given warning (by short or full name)', short: '-O', type: :string
        opt :stdin, 'Read Ruby code from standard input', short: '-s'
        opt :'list-modules', 'Print the discovered, loaded modules'
        opt :profile, 'Run the profiler during execution'
        opt :include, 'specify $LOAD_PATH directory (may be used more than once)', short: '-I', multi: true
        opt :S, 'look for scripts using PATH environment variable', short: '-S'
        warning_opts.each { |warning| opt(*warning) }
      end
    end
51534
function buildConsoleLogger (level = 'info') {
  return function (api) {
    return winston.createLogger({
      format: winston.format.combine(
        winston.format.timestamp(),
        winston.format.colorize(),
        winston.format.printf(info => {
          return `${api.id} @ ${info.timestamp} - ${info.level}: ${info.message} ${stringifyExtraMessagePropertiesForConsole(info)}`
        })
      ),
      level,
      levels: winston.config.syslog.levels,
      transports: [ new winston.transports.Console() ]
    })
  }
}
657131
function parser(opt) {

  var options = opt || Object.create(null);
  var my = {
    filename: resolve(String(options.filename)),
    ip: Boolean(options.ip),
    url: Boolean(options.url),
    response: Boolean(options.response),
    pid: Boolean(options.pid),
    bytesReq: Boolean(options.bytesReq),
    bytesRes: Boolean(options.bytesRes),
    referrer: Boolean(options.referrer),
    auth: Boolean(options.auth),
    agent: Boolean(options.agent),
    version: Boolean(options.version),
    level: Boolean(options.level),
    message: Boolean(options.message),
    timestamp: Boolean(options.timestamp),
    report: options.report === false ? false : true,
    csv: options.csv,
    search: options.search
  };
  if (!fs.existsSync(my.filename)) {
    var e = my.filename + ' not exists';
    throw new Error(e);
  }
  if (my.csv) {
    my.csv = resolve(String(my.csv));
  }
  if (my.search) {
    my.search = new RegExp(my.search, 'g');
  }

  return wrapper(my);
}