set up logging per: https://gist.github.com/spmason/1670196
543824
function get_logger(label, filename){
    if(!filename){
        filename = __dirname + '/application.log'
    }
    var logger = new winston.Logger()
    var production = (env.NODE_ENV || '').toLowerCase() === 'production';
    // express/connect also defaults to looking at env.NODE_ENV

    // Override the built-in console methods with winston hooks
    var loglevel = env.CAS_VALIDATE_LOGLEVEL || env.LOGLEVEL || 'info'

    switch(((env.NODE_ENV) || '').toLowerCase()){
        case 'production':
        production = true
        loglevel='warn'
        logger.add(winston.transports.File,
                   {filename: filename
                   ,handleExceptions: true
                   ,exitOnError: false
                   ,level: 'warn'
                   ,label: label
                   });
        break
        case 'development':
        loglevel='debug'
        logger.add(winston.transports.Console,
                   {colorize: true
                   ,timestamp: true
                   ,level: loglevel
                   ,label: label
                   });
        break
        default:
        logger.add(winston.transports.Console,
                   {colorize: true
                   ,timestamp: true
                   ,level: loglevel
                   ,label: label
                   });
        break
        // make loglevels consistent

    }
    logger.setLevels(winston.config.syslog.levels);
    return logger
}
1066890
def setupLogFile(self):
		""""""
		self.logWrite("\n###############################################")
		self.logWrite("calcpkg.py log from " + str(datetime.datetime.now()))
		self.changeLogging(True)
1087182
def set_up_logging(log_file, console_log_level):
    """"""
    logger = logging.getLogger()
    logger.setLevel(logging.DEBUG)
    fh = logging.FileHandler(str(log_file))
    fh.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(console_log_level)
    formatter = logging.Formatter(
        "{asctime} {levelname} ({name}): {message}", style='{'
    )
    fh.setFormatter(formatter)
    ch.setFormatter(formatter)
    logger.addHandler(fh)
    logger.addHandler(ch)

    return logger
75341
def setup_logger(
    base_name,
    root_dir=None,
    enable_json=True,
    json_formatter='tipsi_tools.tipsi_logging.JSFormatter',
    loggers={},
):
    
    if not root_dir:
        root_dir = os.environ.get('LOG_DIR')
    assert root_dir, 'You should pass root_dir parameter or set env LOG_DIR'

    JSON_FORMATTER = {
        '()': json_formatter,
        'env_vars': ['HOST_TYPE', 'TIPSI_CONFIG', 'TIPSI_BRANCH', 'CONTAINER_TYPE'],
    }

    default_loggers = {
        '': {'handlers': ['default'], 'level': 'DEBUG', 'propagate': True},
        'googleapicliet.discovery_cache': {'level': 'ERROR'},
        'boto3': {'level': 'INFO'},
        'botocore': {'level': 'INFO'},
        'kazoo': {'level': 'INFO'},
        'urllib3': {'level': 'INFO'},
    }

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'json': JSON_FORMATTER,
            'standard': {'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'},
        },
        'handlers': {'default': base_handler(get_plain_logname(base_name, root_dir, enable_json))},
        'loggers': {**default_loggers, **loggers},
    }
    if enable_json:
        LOGGING['handlers']['json'] = base_handler(
            os.path.join(root_dir, '{}.json_log'.format(base_name)), formatter='json'
        )
        LOGGING['loggers']['']['handlers'].append('json')
    logging.config.dictConfig(LOGGING)
353836
def setup_logging(config_path=None, log_level=logging.INFO,
                  formatter='standard'):
    

    config = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'standard': {
                'format':
                    '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
            },
            'ui': {
                'format':
                    '[%(levelname)s] %(message)s'
            }
        },
        'handlers': {
            'console': {
                'class': 'logging.StreamHandler',
                'level': log_level,
                'formatter': formatter,
                'stream': 'ext://sys.stdout'
            },
        },
        'loggers': {
            '': {
                'handlers': ['console'],
                'level': log_level,
                'propagate': True
            },
            'yapsy': {
                'handlers': ['console'],
                'level': logging.INFO
            }
        }
    }

    if config_path:
        if os.path.exists(config_path):
            with open(config_path, 'rt') as f:
                config = yaml.safe_load(f.read())
        else:
            print('Specified path does not exist: {}, '
                  'using default config'.format(config_path))

    logging.config.dictConfig(config)
523172
function logger (req, res, next) {
    var now = new Date();

    function logRequest()
    {
        var ok = 200 <= res.statusCode && res.statusCode <= 400;
        if (ok && config.methods.indexOf(req.method) < 0)
            return;
            
        var audit = {
            who: config.user(req),
            when: now.toISOString(),
            where: {
                client: req.ip || req._remoteAddress || (req.connection ? req.connection.remoteAddress : undefined),
                host: req.headers.host,
                server: config.hostname
			},
            why: req.method,
            what: (req.method == 'POST') ? res._headers['location'] : req.url,
            status: res.statusCode,
        };
        sally.log(audit);
    }
    
    onFinished(res, logRequest);
    next();
}
360036
def configure_logging(conf):
    """"""
    root_logger = logging.getLogger()
    root_logger.setLevel(getattr(logging, conf.loglevel.upper()))
    if conf.logtostderr:
        add_stream_handler(root_logger, sys.stderr)
    if conf.logtostdout:
        add_stream_handler(root_logger, sys.stdout)
626538
def setup_logging(
        config_directories=None,
        config_file=None,
        default_level=logging.INFO,
        default_filename="logging.yml"
):
    
    config_found = False
    config_file_path = None
    if config_file:
        config_file_path = config_file
        if os.path.isfile(config_file_path) and os.access(config_file_path, os.R_OK):
            config_found = True
    else:
        for directory in config_directories:
            if directory is None:
                continue
            config_file_path = os.path.join(directory, default_filename)
            if os.path.isfile(config_file_path) and os.access(config_file_path, os.R_OK):
                config_found = True
                break
    if config_found:
        with open(config_file_path, 'rt') as ymlfile:
            config = yaml.safe_load(ymlfile.read())
        logging.config.dictConfig(config)
    else:
        logging.basicConfig(level=default_level)
480053
def setup_logging(filename, log_dir=None, force_setup=False):
    ''' 
    '''
    if not force_setup and ChirpCLI.SETUP_COMPLETED:
        logging.debug("Master logging has been setup. This call will be ignored.")
        return
    if log_dir and not os.path.exists(log_dir):
        os.makedirs(log_dir)
    if os.path.isfile(filename):
        with open(filename) as config_file:
            try:
                config = json.load(config_file)
                logging.config.dictConfig(config)
                logging.info("logging was setup using {}".format(filename))
                ChirpCLI.SETUP_COMPLETED = True
            except Exception as e:
                logging.exception("Could not load logging config")
                # default logging config
                logging.basicConfig(level=logging.INFO)
    else:
        logging.basicConfig(level=logging.INFO)
114041
function(settings, callback) {
    "use strict";

    if (typeof settings === 'function') {
      callback = settings;
      settings = {};
    }

    if (typeof settings === 'undefined') {
      settings = {};
    }

    if (typeof callback !== 'function') {
      callback = function () {};
    }

    getLogFiles(function () {
      parseOptions(settings, function () {
        setupLogger();

        require('./Logger').verbose('Starting worker manager');

        // Start the Master
        master = require('./master');

        registerListeners(master);

        master.start();

        callback();
      });
    });
  }
213714
function mkLoggerIfNeeded(level) {
    if (console && console[level] && typeof console[level] == "function" && console[level].call) {
        return function() {
            if (console[level].apply) {
                console[level].apply(console, [].slice.call(arguments));
            } else if (console[level].call) {
                console[level]([].slice.call(arguments).join(" "));
            }
        }
    } else if (console && console.log) {
        var prefix = level.toUpperCase()+": ";
        return function() {
            console.log(prefix + [].slice.call(arguments).join(" "));
        }
    } else return function(){ /* NOOP Logging IE<=8, FF<=2 */ };
}
702983
def _setup_logging(cls, args):
        '''
        '''
        assert (
            logging.CRITICAL >
            logging.ERROR >
            logging.WARNING >
            logging.INFO >
            logging.DEBUG >
            logging.NOTSET
        )
        assert (
            LOG_VERY_QUIET >
            LOG_QUIET >
            LOG_NO_VERBOSE >
            LOG_VERBOSE >
            LOG_DEBUG
        )
        assert args.verbosity

        root_logger = logging.getLogger()
        current_level = root_logger.getEffectiveLevel()
        min_level = LOG_VERY_QUIET

        if args.verbosity == LOG_QUIET:
            min_level = logging.ERROR

        if args.verbosity in (LOG_NO_VERBOSE, LOG_VERBOSE) \
                or args.warc_file \
                or args.output_file or args.append_output:
            min_level = logging.INFO

        if args.verbosity == LOG_DEBUG:
            min_level = logging.DEBUG

        if current_level > min_level:
            root_logger.setLevel(min_level)
            root_logger.debug(
                'Wpull needs the root logger level set to {0}.'
                    .format(min_level)
            )

        if current_level <= logging.INFO:
            logging.captureWarnings(True)
788244
def _setup_logger(self, logging_level: int, log_to_console: bool):
        
        self.logger = logging.getLogger('discord')
        self.logger.handlers = []
        self.logger.setLevel(logging_level)
        formatter = logging.Formatter(style='{', fmt='{asctime} [{levelname}] {message}', datefmt='%Y-%m-%d %H:%M:%S')
        file_handler = logging.FileHandler('pycord.log')
        file_handler.setFormatter(formatter)
        file_handler.setLevel(logging_level)
        self.logger.addHandler(file_handler)
        if log_to_console:
            stream_handler = logging.StreamHandler(sys.stdout)
            stream_handler.setFormatter(formatter)
            stream_handler.setLevel(logging_level)
            self.logger.addHandler(stream_handler)
894556
def setup_logging(home, verbose):
    """"""
    logging.setLoggerClass(MyLogger)
    logging.config.dictConfig({
        "version": 1,
        "disable_existing_loggers": False,
        "formatters": {
            "console": {
                "format": "%(levelname)-8s [%(asctime)s %(name)s] %(filename)s:%(lineno)s %(funcName)s: %(message)s",
            },
            "json": {
                "()": jsonlogger.JsonFormatter,
                "format": "%(levelname)s %(asctime)s %(name)s %(filename)s %(lineno)s %(funcName)s %(message)s",
            },
        },
        "handlers": {
            "default": {
                "level": "DEBUG" if verbose else "INFO",
                "class": "logging.StreamHandler",
                "formatter": "console",
            },
            "file": {
                "level": "DEBUG",
                "class": "logging.handlers.WatchedFileHandler",
                "filename": os.path.join(home, DEBUG_LOG_FILE),
                "formatter": "json",
            },
        },
        "loggers": {
            "": {
                "handlers": ["default", "file"],
                "level": "DEBUG",
                "propagate": True,
            },
        }
    })
563623
def setup_logging(self):
        
        logging.getLogger('amqp').setLevel(str_to_logging(self.get('logging', 'amqp')))
        logging.getLogger('rdflib').setLevel(str_to_logging(self.get('logging', 'rdflib')))
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)
632772
def setup_logging(format="%(asctime)s - %(levelname)s - %(message)s", level='INFO'):
    """"""
    try:
        import coloredlogs
        coloredlogs.install(fmt=format, level=level)
    except ImportError:
        logging.basicConfig(format=format, level=level)