Setup logging configuration
4182
def setup_logging(default_path='logging.yaml', env_key='LOG_CFG'):
    
    path = default_path
    value = os.getenv(env_key, None)
    if value:
        path = value
    if os.path.exists(path):
        with open(path, 'rt') as f:
            configs = yaml.safe_load(f.read())
        logging.config.dictConfig(configs)
    else:
        logging.config.dictConfig(config)
693658
def setup_logging(log_level=logging.INFO):
    """"""
    logging.basicConfig(level=log_level)
    fmt = ("%(asctime)s %(levelname)s (%(threadName)s) "
           "[%(name)s] %(message)s")
    colorfmt = "%(log_color)s{}%(reset)s".format(fmt)
    datefmt = '%Y-%m-%d %H:%M:%S'

    # Suppress overly verbose logs from libraries that aren't helpful
    logging.getLogger('requests').setLevel(logging.WARNING)

    try:
        from colorlog import ColoredFormatter
        logging.getLogger().handlers[0].setFormatter(ColoredFormatter(
            colorfmt,
            datefmt=datefmt,
            reset=True,
            log_colors={
                'DEBUG': 'cyan',
                'INFO': 'green',
                'WARNING': 'yellow',
                'ERROR': 'red',
                'CRITICAL': 'red',
            }
        ))
    except ImportError:
        pass

    logger = logging.getLogger('')
    logger.setLevel(log_level)
465047
function setup(logs) {
  const streams = [];
  if (logs == null) {
    logs = [{ type: 'stdout', format: 'pretty', level: 'http' }];
  }

  logs.forEach(function(target) {
    let level = target.level || 35;
    if (level === 'http') {
      level = 35;
    }

    // create a stream for each log configuration
    if (target.type === 'rotating-file') {
      if (target.format !== 'json') {
        throw new Error('Rotating file streams only work with JSON!');
      }
      if (cluster.isWorker) {
        // https://github.com/trentm/node-bunyan#stream-type-rotating-file
        throw new Error('Cluster mode is not supported for rotating-file!');
      }

      const stream = new VerdaccioRotatingFileStream(
        _.merge(
          {},
          // Defaults can be found here: https://github.com/trentm/node-bunyan#stream-type-rotating-file
          target.options || {},
          { path: target.path, level }
        )
      );

      streams.push({
        type: 'raw',
        level,
        stream,
      });
    } else {
      const stream = new Stream();
      stream.writable = true;

      let destination;
      let destinationIsTTY = false;
      if (target.type === 'file') {
        // destination stream
        destination = require('fs').createWriteStream(target.path, { flags: 'a', encoding: 'utf8' });
        destination.on('error', function(err) {
          stream.emit('error', err);
        });
      } else if (target.type === 'stdout' || target.type === 'stderr') {
        destination = target.type === 'stdout' ? process.stdout : process.stderr;
        destinationIsTTY = destination.isTTY;
      } else {
        throw Error('wrong target type for a log');
      }

      if (target.format === 'pretty') {
        // making fake stream for pretty printing
        stream.write = obj => {
          destination.write(`${print(obj.level, obj.msg, obj, destinationIsTTY)}\n`);
        };
      } else if (target.format === 'pretty-timestamped') {
        // making fake stream for pretty printing
        stream.write = obj => {
          destination.write(`[${dayjs(obj.time).format('YYYY-MM-DD HH:mm:ss')}] ${print(obj.level, obj.msg, obj, destinationIsTTY)}\n`);
        };
      } else {
        stream.write = obj => {
          const msg = fillInMsgTemplate(obj.msg, obj, destinationIsTTY);
          destination.write(`${JSON.stringify({ ...obj, msg }, Logger.safeCycles())}\n`);
        };
      }

      streams.push({
        type: 'raw',
        level,
        stream: stream,
      });
    }
  });

  // buyan default configuration
  const logger = new Logger({
    name: pkgJSON.name,
    streams: streams,
    serializers: {
      err: Logger.stdSerializers.err,
      req: Logger.stdSerializers.req,
      res: Logger.stdSerializers.res,
    },
  });

  process.on('SIGUSR2', function() {
    Logger.reopenFileStreams();
  });

  module.exports.logger = logger;
}
1074161
def setup(cls,
              opts=type('opts', (), {
                  'background': None,
                  'logdir': None,
                  'logging_conf_file': None,
                  'log_level': 'DEBUG'
              })):
        """"""
        logger = logging.getLogger('luigi')

        if cls._configured:
            logger.info('logging already configured')
            return False
        cls._configured = True

        if cls.config.getboolean('core', 'no_configure_logging', False):
            logger.info('logging disabled in settings')
            return False

        configured = cls._cli(opts)
        if configured:
            logger = logging.getLogger('luigi')
            logger.info('logging configured via special settings')
            return True

        configured = cls._conf(opts)
        if configured:
            logger = logging.getLogger('luigi')
            logger.info('logging configured via *.conf file')
            return True

        configured = cls._section(opts)
        if configured:
            logger = logging.getLogger('luigi')
            logger.info('logging configured via config section')
            return True

        configured = cls._default(opts)
        if configured:
            logger = logging.getLogger('luigi')
            logger.info('logging configured by default settings')
        return configured
1062814
def setup(self, settings):
        '''
        
        '''
        # set up the default sc logger
        my_level = settings.get('SC_LOG_LEVEL', 'INFO')
        my_name = settings.get('SC_LOGGER_NAME', 'sc-logger')
        my_output = settings.get('SC_LOG_STDOUT', True)
        my_json = settings.get('SC_LOG_JSON', False)
        my_dir = settings.get('SC_LOG_DIR', 'logs')
        my_bytes = settings.get('SC_LOG_MAX_BYTES', '10MB')
        my_file = settings.get('SC_LOG_FILE', 'main.log')
        my_backups = settings.get('SC_LOG_BACKUPS', 5)

        self.logger = LogFactory.get_instance(json=my_json,
                                         name=my_name,
                                         stdout=my_output,
                                         level=my_level,
                                         dir=my_dir,
                                         file=my_file,
                                         bytes=my_bytes,
                                         backups=my_backups)
143441
def _setup_logger(self, level, log_file):
        """"""
        if logger.handlers:
            return
        level = getattr(logging, level.upper())
        logger.setLevel(level)
        formatter = logging.Formatter(
            '[%(levelname)s] %(asctime)s - %(module)s.%(funcName)s() - %(message)s')
        handler = logging.StreamHandler()
        logger.addHandler(handler)
        handler.setFormatter(formatter)
        if not log_file:
            return
        try:
            handler = TimedRotatingFileHandler(log_file)
        except IOError:
            logger.error("Could not write to %s, falling back to stdout",
                         log_file)
        else:
            logger.addHandler(handler)
            handler.setFormatter(formatter)
707851
def setup_logging(fail_silently=False):
    
    config = None

    paths = list(get_config_paths(filename='logconfig.yml', reversed=True))
    for path in paths:
        if not os.path.exists(path):
            continue

        with open(path, 'rt') as f:
            config = yaml.safe_load(f.read())

        LOG_LEVEL = os.environ.get('LOG_LEVEL')
        if LOG_LEVEL:
            config['root']['level'] = LOG_LEVEL.upper()
            config['handlers']['console']['level'] = LOG_LEVEL.upper()

        logging.config.dictConfig(config)

        break
    else:
        if not fail_silently:
            raise LogconfigError('Unable to find logconfig in {}'.format(paths))

    return config
1066890
def setupLogFile(self):
		""""""
		self.logWrite("\n###############################################")
		self.logWrite("calcpkg.py log from " + str(datetime.datetime.now()))
		self.changeLogging(True)
894209
def setup_logging():
    
    fmt = 'DBG<0>%(pathname)s:%(lineno)d  %(funcName)s: %(message)s'

    handler_stderr = logging.StreamHandler(sys.stderr)
    handler_stderr.setFormatter(logging.Formatter(fmt))
    if OPTIONS['--verbose'] == 1:
        handler_stderr.addFilter(logging.Filter(__name__))

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.DEBUG)
    root_logger.addHandler(handler_stderr)
810102
function logSetup() {
    JuttleLogger.getLogger = log4js.getLogger;

    let levels = {
        '[all]': 'info'
    };

    // Handle node.js style debug configuration where DEBUG is a
    // comma-separated list of debug targets, or '*' to enable all
    // debugging.
    let DEBUG = process.env.DEBUG;
    if (DEBUG) {
        let targets = DEBUG.split(',');
        _.each(targets, function(target) {
            if (target === '*') { target = '[all]'; }
            levels[target] = 'debug';
        });
    }

    log4js.configure({
        levels: levels,
        appenders: [{type: __dirname + '/stderr-appender'}]
    });

    JuttleLogger.getLogger('cli').debug('set logging levels to', levels);
}
311717
def setup_logging(debug, logfile=None):
    '''
    
    '''
    if debug:
        level = logging.DEBUG
    else:
        level = logging.INFO
    if logfile is not None:
        logging.basicConfig(format="%(asctime)s %(levelname)8s %(message)s", datefmt="%H:%M:%S %Y/%m/%d", level=level, filename=logfile)
    else:
        logging.basicConfig(format="%(asctime)s %(levelname)8s %(message)s", datefmt="%H:%M:%S %Y/%m/%d", level=level)
611709
def log_config():
    """"""
    conf = '\n'.join(
            ['{}="{}"'.format(k, v) for k, v
             in sorted(options.as_dict().iteritems())])
    logging.info('Service started with the following settings:\n' + conf)
925335
def setup_logger(log=None, level='INFO'):
    
    if not log:
        log = logging.getLogger()
    if not log.handlers:
        channel = logging.StreamHandler()
        channel.setFormatter(DebugLogFormatter())

        log.setLevel(level)
        log.addHandler(channel)

        # setup styling for repo loggers
        repo_logger = logging.getLogger('libvcs')
        channel = logging.StreamHandler()
        channel.setFormatter(RepoLogFormatter())
        channel.addFilter(RepoFilter())
        repo_logger.setLevel(level)
        repo_logger.addHandler(channel)
849265
def setup_logging(
    file_name='logging.json', 
    default_level=logging.INFO,
):
    

    current_dir =  os.path.abspath(os.path.dirname(__file__))
    
    file_path = current_dir + '/' + file_name 

    if os.path.exists(file_path):
        with open(file_path, 'rt') as f:
            data = f.read()
            config = json.loads(data)
        logging.config.dictConfig(config)
    else:
        logging.basicConfig(level=default_level)

    #stop logs from requests
    requests_log = logging.getLogger("requests")
    requests_log.setLevel(logging.WARNING)
1268689
def configure_logging(debug=False):
    
    if not debug:
        logging.basicConfig(level=logging.INFO,
                            format=LOG_FORMAT)
    else:
        logging.basicConfig(level=logging.DEBUG,
                            format=DEBUG_LOG_FORMAT)
171043
def configure_logging(conf):
    """"""
    logging.config.dictConfig({
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'standard': {
                'format': '%(asctime)s [%(name)s] %(levelname)s '
                          '%(processName)s: %(message)s'
            }
        },
        'handlers': {
            'file': {
                'level': conf.LOG_FILE_LEVEL,
                'filename': conf.LOG_FILE,
                'class': 'logging.FileHandler',
                'formatter': 'standard',
            },
            'stdout': {
                'level': conf.LOG_STDOUT_LEVEL,
                'class': 'pyphi.log.TqdmHandler',
                'formatter': 'standard',
            }
        },
        'root': {
            'level': 'DEBUG',
            'handlers': (['file'] if conf.LOG_FILE_LEVEL else []) +
                        (['stdout'] if conf.LOG_STDOUT_LEVEL else [])
        }
    })
400491
def _setup_logging(conf):
    
    if conf['verbose']:
        level = logging.DEBUG
    else:
        level = logging.INFO

    fname = conf['logfile'] if conf['logfile'] != "-" else None

    logging.basicConfig(filename=fname, level=level,
                        format='%(asctime)s - %(levelname)-8s - '
                               '%(threadName)-15s - %(message)s')

    # Don't want to see all the messages from BOTO and watchdog
    logging.getLogger('boto').setLevel(logging.CRITICAL)
    logging.getLogger('watchdog.observers.inotify_buffer'). \
                                                setLevel(logging.CRITICAL)