Dynamic reconfiguration of the log level
970273
def set_log_level(logger, level):  # type: (logging.Logger, int) -> None
    """"""
    if level > 2:
        level = 2
    if level < -1:
        level = -1

    levels = {
        -1: logging.ERROR,
        0: logging.WARN,
        1: logging.INFO,
        2: logging.DEBUG
    }
    logger.setLevel(levels[level])
1188772
def log(self, level, message):
        '''

        '''
        if self.log_fd is not None:
            prefix = struct.pack('ii', level, len(message))
            os.write(self.log_fd, prefix)
            os.write(self.log_fd, message)
917949
def set_log_level(self, level, keep=True):
        
        self._set_log_level(level)
        self._log_level_set_explicitly = keep
914409
def _setup_log(self):
        '''
        
        '''
        logging_level = CONFIG.LOGGING_LEVEL.get(self.log_level.lower())
        logging.basicConfig(format=self.log_format,
                            level=logging_level)
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)
166091
def _setup_logging(self):
        
        self._log_level_delta = (self._args.quiet * 10) - (self._args.verbose * 10)
        level = max(1, self._default_log_level + self._log_level_delta)
        logging.basicConfig(level=level, format=LOG_FORMAT)
1339905
public void configureLogging(final LoggingSettings loggingSettings) {

        final Logger root = (Logger)LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
        final LoggerContext context = root.getLoggerContext();

        // Reset prior configuration
        context.reset();

        // Propagate level changes to java.util.logging
        final LevelChangePropagator propagator = new LevelChangePropagator();
        propagator.setContext(context);
        propagator.setResetJUL(true);

        // Set base threshold for all other loggers.
        root.setLevel(loggingSettings.getLevel());

        // Loop through explicitly configured loggers and set the levels
        for (final Map.Entry<String, Level> entry : loggingSettings.getLoggers().entrySet()) {
            ((Logger)LoggerFactory.getLogger(entry.getKey())).setLevel(entry.getValue());
        }

        if (loggingSettings.getLogFile().isEnabled()) {
            root.addAppender(getFileAppender(loggingSettings.getLogFile(), context));
        }

        if (loggingSettings.getConsole().isEnabled()) {
            root.addAppender(getConsoleAppender(loggingSettings.getConsole(), context));
        }
    }
1046871
function log(logLevel, level, content) {
	var output = true;

	switch (logLevel) {
	case 'slient':
		if (level !== 'lv1') {
			output = false;
		}
		break;
	case 'info':
		if (level === 'lv3') {
			output = false;
		}
		break;
	default:
		output = true;
	}
	if (output) {
		var data = Array.prototype.slice.call(content);
		fancyLog.apply(false, data);
	}
}
954437
def set_log_level(logger_name: str, log_level: str, propagate: bool = False):
    """"""
    log = logging.getLogger(logger_name)
    log.propagate = propagate
    log.setLevel(log_level)
1105234
def _log_changes(ret, changekey, changevalue):
    '''
    
    '''
    cl = ret['changes'].get('new', [])
    cl.append({changekey: _object_reducer(changevalue)})
    ret['changes']['new'] = cl
    return ret
1109081
private void setRunLevel(int level) {

        if (m_instance != null) {
            if (m_instance.m_runLevel >= OpenCms.RUNLEVEL_1_CORE_OBJECT) {
                // otherwise the log is not available
                if (CmsLog.INIT.isInfoEnabled()) {
                    CmsLog.INIT.info(
                        Messages.get().getBundle().key(
                            Messages.INIT_RUNLEVEL_CHANGE_2,
                            new Integer(m_instance.m_runLevel),
                            new Integer(level)));
                }
            }
            m_instance.m_runLevel = level;
        }
    }
637320
private void prepareLogger(String verboseLog) {
        final StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton();
        final LoggerContext context = (LoggerContext) loggerBinder.getLoggerFactory();

        final PatternLayoutEncoder encoder = new PatternLayoutEncoder();
        encoder.setPattern("%d %C:%L%n%-5level - %msg%n");
        encoder.setContext(context);
        encoder.start();
        final FileAppender<ILoggingEvent> fa = new FileAppender<>();
        fa.setAppend(true);
        fa.setEncoder(encoder);
        fa.setContext(context);
        fa.setFile(verboseLog);
        final File f = new File(verboseLog);
        String name = f.getName();
        final int i = name.lastIndexOf('.');
        if (i > 1) {
            name = name.substring(0, i);
        }
        fa.setName(name);
        fa.start();
        final ch.qos.logback.classic.Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
        rootLogger.setLevel(Level.DEBUG);
        final ThresholdFilter filter = new ThresholdFilter();
        filter.setLevel(LogLevel.INFO.getValue());
        filter.setContext(context);
        filter.start();
        rootLogger.iteratorForAppenders().forEachRemaining(action -> {
            action.addFilter(filter);
        });
        rootLogger.addAppender(fa);
    }
1340095
def setup_logger(log_level, log_file=None):
    """"""
    level = getattr(logging, log_level.upper(), None)
    if not level:
        color_print("Invalid log level: %s" % log_level, "RED")
        sys.exit(1)

    # hide traceback when log level is INFO/WARNING/ERROR/CRITICAL
    if level >= logging.INFO:
        sys.tracebacklimit = 0

    formatter = ColoredFormatter(
        u"%(log_color)s%(bg_white)s%(levelname)-8s%(reset)s %(message)s",
        datefmt=None,
        reset=True,
        log_colors=log_colors_config
    )

    if log_file:
        handler = logging.FileHandler(log_file, encoding="utf-8")
    else:
        handler = logging.StreamHandler()

    handler.setFormatter(formatter)
    logger.addHandler(handler)
    logger.setLevel(level)
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 [])
        }
    })
768299
def set_log_level(self, level=logging.INFO):
        
        mod, cls = self.parse_module_class()
        logging.getLogger(mod).setLevel(level)
1002525
def configure_logging(level=logging.DEBUG):
    """"""
    if level == logging.DEBUG:
        # For debugging purposes, log from everyone!
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s - %(levelname)s - %(message)s'
        )
        return logging

    logger = logging.getLogger(__name__)
    logger.setLevel(level)
    formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
    ch = logging.StreamHandler()
    ch.setLevel(level)
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    return logger
1161362
def configure_logger(logger, filename, folder, log_level):
    '''
    '''
    fmt = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')
    if folder is not None:
        log_file = os.path.join(folder, filename)
        hdl = logging.FileHandler(log_file)
        hdl.setFormatter(fmt)
        hdl.setLevel(log_level)
        logger.addHandler(hdl)
    shdl = logging.StreamHandler()
    shdl.setLevel(log_level)
    shdl.setFormatter(fmt)
    logger.addHandler(shdl)
    logger.setLevel(log_level)