This is used by gcdt plugins to get a logger with the right level.
489718
def getLogger(name):
    """"""
    logger = logging.getLogger(name)
    # note: the level might be adjusted via '-v' option
    logger.setLevel(logging_config['loggers']['gcdt']['level'])
    return logger
169988
def _create_logger_(name):
    """"""
    logger = logging.getLogger(name)
    handler = logging.StreamHandler()
    handler.setFormatter(logging.Formatter('%(levelname)s %(message)s'))
    logger.addHandler(handler)
    logger.setLevel(logging.INFO)
    return logger
1192063
def gen_logger(name: str, log_level: int=logging.INFO) -> logging.Logger:
    
    logger = logging.getLogger(name)
    logger.setLevel(log_level)
    shandler: logging.StreamHandler = logging.StreamHandler(sys.stdout)
    fmt: str = '\033[1;32m%(levelname)-5s %(module)s:%(funcName)s():'
    fmt += '%(lineno)d %(asctime)s\033[0m| %(message)s'
    shandler.setFormatter(logging.Formatter(fmt))
    logger.addHandler(shandler)
    return logger
1326491
def set_logger_level(logger_name, log_level='error'):
    '''
    
    '''
    logging.getLogger(logger_name).setLevel(
        LOG_LEVELS.get(log_level.lower(), logging.ERROR)
    )
52217
def _create_logger(name='did', level=None):
        
        # Create logger, handler and formatter
        logger = logging.getLogger(name)
        handler = logging.StreamHandler()
        handler.setFormatter(Logging.ColoredFormatter())
        logger.addHandler(handler)
        # Save log levels in the logger itself (backward compatibility)
        for level in Logging.LEVELS:
            setattr(logger, level, getattr(logging, level))
        # Additional logging constants and methods for details and data
        logger.DATA = LOG_DATA
        logger.DETAILS = LOG_DETAILS
        logger.ALL = LOG_ALL
        logger.details = lambda message: logger.log(
            LOG_DETAILS, message) # NOQA
        logger.data = lambda message: logger.log(
            LOG_DATA, message) # NOQA
        logger.all = lambda message: logger.log(
            LOG_ALL, message) # NOQA
        return logger
524800
def get_basic_logger(level=logging.WARN, scope='reliure'):
    
    logger = logging.getLogger(scope)
    logger.setLevel(level)
    # create console handler with a higher log level
    ch = logging.StreamHandler()
    ch.setLevel(level)
    # create formatter and add it to the handlers
    formatter = ColorFormatter('%(asctime)s:%(levelname)s:%(name)s:%(message)s')
    ch.setFormatter(formatter)
    # add the handlers to the logger
    logger.addHandler(ch)   
    return logger
733222
def addLogger(self, logger, level=logging.INFO):
        
        if isinstance(logger, logging.Logger):
            logger = logger.name
        
        if logger in self._loggers:
            return
        
        # allow the handler to determine the level for this logger
        if logger == 'root':
            _log = logging.getLogger()
        else:
            _log = logging.getLogger(logger)
        
        _log.addHandler(self.handler())
        
        self._loggers.add(logger)
        self.handler().setLoggerLevel(logger, level)
1060240
def get_logger(name=None, level=logging.DEBUG, stream=None):
    """"""
    logger = logging.getLogger(name)
    colored = colorize_logger(logger, stream=stream, level=level)
    return colored
33580
def ConsoleLogHandler(loggerRef='', handler=None, level=logging.DEBUG, color=None):
    """"""
    if isinstance(loggerRef, logging.Logger):
        pass

    elif isinstance(loggerRef, str):
        # check for root
        if not loggerRef:
            loggerRef = _log

        # check for a valid logger name
        elif loggerRef not in logging.Logger.manager.loggerDict:
            raise RuntimeError("not a valid logger name: %r" % (loggerRef,))

        # get the logger
        loggerRef = logging.getLogger(loggerRef)

    else:
        raise RuntimeError("not a valid logger reference: %r" % (loggerRef,))

    # see if this (or its parent) is a module level logger
    if hasattr(loggerRef, 'globs'):
        loggerRef.globs['_debug'] += 1
    elif hasattr(loggerRef.parent, 'globs'):
        loggerRef.parent.globs['_debug'] += 1

    # make a handler if one wasn't provided
    if not handler:
        handler = logging.StreamHandler()
        handler.setLevel(level)

    # use our formatter
    handler.setFormatter(LoggingFormatter(color))

    # add it to the logger
    loggerRef.addHandler(handler)

    # make sure the logger has at least this level
    loggerRef.setLevel(level)
1374689
function Logger(level) {
    if (_.isString(level) && _.has(LogLevel, level)) {
        this.level = LogLevel[level];    
    } else if (_.isNumber(level) && level >= 0 && level <= 4) {
        this.level = level;
    } else {
        this.level = LogLevel.info;
    }    
}
1374664
def set_loglevel(loggers, level):
    """"""
    if not loggers:
        return
    if 'all' in loggers:
        loggers = lognames.keys()
    for key in loggers:
        logging.getLogger(lognames[key]).setLevel(level)
22110
function(logger, LevelController, moduleDir) {
    if(logger === null) {
        this.logger = new ConsoleLogger(false);
    } else if(logger instanceof BaseLogger) {
        this.logger = logger;
    } else {
        throw Errors.invalidParameter('logger', 'BaseLogger');
    }
    
    this.commandLineParser = null;
    this.moduleDir = moduleDir;
    this.LevelController = LevelController;
}
667322
def get_logger(name='', log_stream=None, log_file=None,
               quiet=False, verbose=False):
    """"""

    # configure root logger
    log_level = logging.INFO
    if quiet:
        log_level = logging.WARNING
    elif verbose:
        log_level = logging.DEBUG

    if log_stream is None:
        log_stream = sys.stdout

    new_logger = configure_logger(name, log_stream=log_stream,
                                  log_file=log_file, log_level=log_level)

    return new_logger
251807
public Logger get_logger() {
	if (logger == null) {
	    logger = Logger.getLogger(get_name().toLowerCase());
	    logger.setAdditivity(false);
	    logger.setLevel(Level.WARN);
	    last_level = Level.WARN;
	}
	return logger;
    }
361250
def build_default_logger(
    logger_name='logger',
    log_level=None,
    log_dir=None,
    console_enabled=True,
    max_log_size=5*1024*1024,
    max_backup_logs=5):
    '''
    
    '''
    old_logger_class = logging.getLoggerClass()
    logging.setLoggerClass(DefaultLogger)
    logger = logging.getLogger(logger_name)
    logging.setLoggerClass(old_logger_class)

    if log_level:
        logger.setLevel(log_level)
    logger.apply_default_handlers(log_dir, console_enabled, max_log_size, max_backup_logs)
    return logger
37971
def getLogger(name=None, filename=None, filemode=None, level=WARNING):
    
    warnings.warn("getLogger is deprecated, Use get_logger instead.",
                  DeprecationWarning, stacklevel=2)
    return get_logger(name, filename, filemode, level)
888639
def get_logger():
    
    root = logging.getLogger()
    root.setLevel(logging.WARNING)
    ch = logging.StreamHandler(sys.stderr)
    ch.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(message)s')
    ch.setFormatter(formatter)
    root.addHandler(ch)
    return root