generator to create the logging instance
977367
function createLogger(instance){

    // generator
    function log(level){
        return function(...args){

            // logging backend available ?
            if (_loggingBackends.length > 0){

                // trigger backends
                _loggingBackends.forEach(function(backend){
                    backend.apply(backend, [instance, level, args]);
                });

            // use default backend
            }else{
                _defaultBackend.apply(_defaultBackend, [instance, level, args]);
            }
        }
    }
    
    return exposeAPI(log);
}
1102006
def get_logger(name=None, level=None, stream=DEFAULT_STREAM,
               clobber_root_handler=True, logger_factory=None,
               wrapper_class=None):
    """"""
    _configure_logger(
        logger_factory=logger_factory,
        wrapper_class=wrapper_class)
    log = structlog.get_logger(name)
    root_logger = logging.root
    if log == root_logger:
        if not _has_streamhandler(root_logger, level=level, stream=stream):
            stream_handler = logging.StreamHandler(stream)
            stream_handler.setLevel(level)
            stream_handler.setFormatter(logging.Formatter(fmt=LOG_FORMAT))
            root_logger.addHandler(stream_handler)
        else:
            if clobber_root_handler:
                for handler in root_logger.handlers:
                    handler.setFormatter(logging.Formatter(fmt=LOG_FORMAT))
    if level:
        log.setLevel(level)
    return log
176391
def logger_new (self, loggername, **kwargs):
        """"""
        args = self[loggername]
        args.update(kwargs)
        return self.loggers[loggername](**args)
1143636
def createLogger(name, level=logging.WARNING):
    """"""
    logger = logging.getLogger(name)
    logger.setLevel(level)
    handler = logging.StreamHandler()
    handler.setFormatter(logging.Formatter('%(asctime)s [%(levelname)s] %(name)s: %(message)s'))
    logger.addHandler(handler)
    logger.propagate = False
    return logger
545228
def setup_logger(log_dir=None, loglevel=logging.DEBUG):
    

    create_home_dir()
    create_dir(os.path.join(get_default_home_dir(), 'log'))

    if log_dir is None:
        log_dir = os.path.join(get_default_home_dir(), 'log')

    logger = logging.getLogger('ding0') # use filename as name in log
    logger.setLevel(loglevel)

    # create a file handler
    handler = logging.FileHandler(os.path.join(log_dir, 'ding0.log'))
    handler.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        '%(asctime)s-%(funcName)s-%(message)s (%(levelname)s)')
    handler.setFormatter(formatter)

    # create a stream handler (print to prompt)
    stream = logging.StreamHandler()
    stream.setLevel(logging.INFO)
    stream_formatter = logging.Formatter(
        '%(message)s (%(levelname)s)')
    stream.setFormatter(stream_formatter)

    # add the handlers to the logger
    logger.addHandler(handler)
    logger.addHandler(stream)

    logger.info('########## New run of Ding0 issued #############')

    return logger
663484
def setup_logger():  # type: () -> logging.Logger
    
    formatter = logging.Formatter(
        fmt='%(levelname)s - %(module)s - %(message)s')

    handler = logging.StreamHandler()
    handler.setFormatter(formatter)

    logger = logging.getLogger()
    logger.setLevel(logging.DEBUG)
    logger.addHandler(handler)
    return logger
1297768
def getLogger(name):
    '''  '''

    # Create logger and add a default NULL handler
    log = logging.getLogger(name)
    log.addHandler(_NullHandler())

    return log
326344
def _initialize_logging():
    

    # Starting the console handler if a terminal is available.
    if sys.stdout.isatty() or platform.system() in ("Darwin", "Linux"):
        RuntimeGlobals.logging_console_handler = foundations.verbose.get_logging_console_handler()

    # Defining logging formatters.
    RuntimeGlobals.logging_formatters = {"Default": foundations.verbose.LOGGING_DEFAULT_FORMATTER,
                                         "Extended": foundations.verbose.LOGGING_EXTENDED_FORMATTER,
                                         "Standard": foundations.verbose.LOGGING_STANDARD_FORMATTER}
1047197
def _build_logger(self, level=logging.INFO):
        
        self._debug_stream = StringIO()
        logger = logging.getLogger('sprinter')
        # stdout log
        out_hdlr = logging.StreamHandler(sys.stdout)
        out_hdlr.setLevel(level)
        logger.addHandler(out_hdlr)
        # debug log
        debug_hdlr = logging.StreamHandler(self._debug_stream)
        debug_hdlr.setFormatter(logging.Formatter('%(asctime)s %(message)s'))
        debug_hdlr.setLevel(logging.DEBUG)
        logger.addHandler(debug_hdlr)
        logger.setLevel(logging.DEBUG)
        return logger
1225029
def initialize_logging(args):
    """"""
    log_handler = logging.StreamHandler()
    log_formatter = logging.Formatter(
        "%(levelname)s %(asctime)s %(name)s:%(lineno)04d - %(message)s")
    log_handler.setFormatter(log_formatter)

    root_logger = logging.getLogger()
    root_logger.addHandler(log_handler)
    root_logger.setLevel(getattr(logging, args.loglevel))
656897
def init_log(*handlers, **kwargs):
    
    disable_existing_loggers = kwargs.get('disable_existing_loggers', False)

    handlers_config = [t.get_handler() for t in handlers]
    new_handlers_config = {}
    for t in handlers_config:
        new_handlers_config.update(t)

    formatter_config = [t.get_formatter() for t in handlers]
    new_formatter_config = {}
    for t in formatter_config:
        new_formatter_config.update(t)

    handler_name_list = [t.get_formatter_name() for t in handlers]
    dict_config = {
        'version': 1,
        'disable_existing_loggers': disable_existing_loggers,
        'formatters': new_formatter_config,
        'handlers': new_handlers_config,
        'loggers': {
            '': {
                'handlers': handler_name_list,
                'level': 'DEBUG',
            }
        }
    }

    logging.config.dictConfig(dict_config)
641051
def create_logger(name, formatter=None, handler=None, level=None):
    
    logger = logging.getLogger(name)

    #: remove existing handlers
    logger.handlers = []

    #: use a standard out handler
    if handler is None:
        handler = logging.StreamHandler(sys.stdout)

    #: set the formatter when a formatter is given
    if formatter is not None:
        handler.setFormatter(formatter)

    #: set DEBUG level if no level is specified
    if level is None:
        level = logging.DEBUG

    handler.setLevel(level)
    logger.setLevel(level)
    logger.addHandler(handler)
    return logger
1174356
def init_logger(root_dir, name="train.log"):
    
    os.makedirs(root_dir, exist_ok=True)
    log_formatter = logging.Formatter("%(message)s")
    logger = logging.getLogger(name)
    file_handler = logging.FileHandler("{0}/{1}".format(root_dir, name), mode='w')
    file_handler.setFormatter(log_formatter)
    logger.addHandler(file_handler)
    console_handler = logging.StreamHandler()
    console_handler.setFormatter(log_formatter)
    logger.addHandler(console_handler)
    logger.setLevel(logging.INFO)
    return logger
225143
def get_logger(context=None, name=None):
    
    # Many class instances have their own logger. Share them to save memory if
    # possible, i.e. when *context* is not set.
    if name is None:
        name = _logger_name
    if context is None and name in _logger_dict:
        return _logger_dict[name]
    if context is not None and not isinstance(context, six.string_types):
        context = util.objref(context)
    logger = logging.getLogger(name)
    logger = ContextLogger(logger, context)
    if context is None:
        _logger_dict[name] = logger
    return logger
222041
def init_logger(self):
        """"""
        # All logs are comming to this logger
        self.logger.setLevel(logging.DEBUG)
        self.logger.propagate = False

        # Logging to console
        if self.min_log_level_to_print:
            level = self.min_log_level_to_print
            handler_class = logging.StreamHandler
            self._create_handler(handler_class, level)

        # Logging to file
        if self.min_log_level_to_save:
            level = self.min_log_level_to_save
            handler_class = logging.handlers.TimedRotatingFileHandler
            self._create_handler(handler_class, level)

        # Logging to syslog
        if self.min_log_level_to_syslog:
            level = self.min_log_level_to_syslog
            handler_class = logging.handlers.SysLogHandler
            self._create_handler(handler_class, level)

        # Logging to email
        if self.min_log_level_to_mail:
            level = self.min_log_level_to_mail
            handler_class = AlkiviEmailHandler
            self._create_handler(handler_class, level)

        return
561025
def log_create(sender, instance, created, **kwargs):
    
    if created:
        changes = model_instance_diff(None, instance)

        log_entry = LogEntry.objects.log_create(
            instance,
            action=LogEntry.Action.CREATE,
            changes=json.dumps(changes),
        )
182433
private Logger createLoggerInstance(String loggerName) throws Exception
    {
        Class loggerClass = getConfiguration().getLoggerClass();
        Logger log = (Logger) ClassHelper.newInstance(loggerClass, String.class, loggerName);
        log.configure(getConfiguration());
        return log;
    }