Creates a logger intended for use by applications using CloeePy. This logger
        is fully configurable by the user and can include custom fields
346146
def _set_application_logger(self):
        
        formatter = None
        if self._formatter == "json":
            if hasattr(self._config, "formatString"):
                formatter = CustomJsonFormatter(self._config.formatString)
            else:
                formatter = CustomJsonFormatter(self.default_json_fmt)
        else:
            if hasattr(self._config, "formatString"):
                formatter = logging.Formatter(self._config.formatString)
            else:
                formatter = logging.Formatter(self.default_txt_fmt)

        # get logging.Logger instance and set formatter
        self.logger = logging.getLogger('CloeePyApplication')
        logHandler = logging.StreamHandler()
        logHandler.setFormatter(formatter)
        self.logger.addHandler(logHandler)
        self.logger.setLevel(self._log_level)
947469
def _configure_logger(fmt, quiet, level, fpath,
    pre_hooks, post_hooks, metric_grouping_interval):
    

    # NOTE not thread safe. Multiple BaseScripts cannot be instantiated concurrently.
    level = getattr(logging, level.upper())

    global _GLOBAL_LOG_CONFIGURED
    if _GLOBAL_LOG_CONFIGURED:
        return

    # since the hooks need to run through structlog, need to wrap them like processors
    def wrap_hook(fn):
        @wraps(fn)
        def processor(logger, method_name, event_dict):
            fn(event_dict)
            return event_dict

        return processor

    processors = define_log_processors()
    processors.extend(
        [ wrap_hook(h) for h in pre_hooks ]
    )
    if metric_grouping_interval:
        processors.append(metrics_grouping_processor)

    log_renderer = define_log_renderer(fmt, fpath, quiet)
    stderr_required = (not quiet)
    pretty_to_stderr = (
        stderr_required
        and (
            fmt == "pretty"
            or (fmt is None and sys.stderr.isatty())
        )
    )

    should_inject_pretty_renderer = (
        pretty_to_stderr
        and not isinstance(log_renderer, structlog.dev.ConsoleRenderer)
    )
    if should_inject_pretty_renderer:
        stderr_required = False
        processors.append(StderrConsoleRenderer())

    processors.append(log_renderer)
    processors.extend(
        [ wrap_hook(h) for h in post_hooks ]
    )

    streams = []
    # we need to use a stream if we are writing to both file and stderr, and both are json
    if stderr_required:
        streams.append(sys.stderr)

    if fpath is not None:
        # TODO handle creating a directory for this log file ?
        # TODO set mode and encoding appropriately
        streams.append(open(fpath, 'a'))

    assert len(streams) != 0, "cannot configure logger for 0 streams"

    stream = streams[0] if len(streams) == 1 else Stream(*streams)
    atexit.register(stream.close)

    # a global level struct log config unless otherwise specified.
    structlog.configure(
        processors=processors,
        context_class=dict,
        logger_factory=LevelLoggerFactory(stream, level=level),
        wrapper_class=BoundLevelLogger,
        cache_logger_on_first_use=True,
    )

    # TODO take care of removing other handlers
    stdlib_root_log = logging.getLogger()
    stdlib_root_log.addHandler(StdlibStructlogHandler())
    stdlib_root_log.setLevel(level)

    _GLOBAL_LOG_CONFIGURED = True
64130
function _createLogger(log) {
    assert.optionalObject(log, 'log');

    if (log) {
        // TODO avoid this .child if already have the serializers, e.g. for
        // recursive call.
        return log.child({
            serializers: restifyClients.bunyan.serializers
        });
    } else {
        return bunyan.createLogger({
            name: 'registry',
            serializers: restifyClients.bunyan.serializers
        });
    }
}
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
1333916
def configure_logger(options)
      log.color_enabled = options.fetch(:color, log.tty?)
      log.summary_enabled = options.fetch(:summary, true)
    end
1365678
private function initializeLogger()
    {
        if (Log::hasLogger()) {
            return;
        }

        $logger = new Logger($this->getConfig()['log']['name'] ?? 'foundation');

        if (!$this->getConfig()['debug'] ?? false || defined('PHPUNIT_RUNNING')) {
            $logger->pushHandler(new NullHandler());
        } elseif (($this->getConfig()['log']['handler'] ?? null) instanceof HandlerInterface) {
            $logger->pushHandler($this->getConfig()['log']['handler']);
        } elseif ($logFile = $this->getConfig()['log']['file'] ?? null) {
            $logger->pushHandler(new StreamHandler(
                    $logFile,
                    $this->getConfig()['log']['level'] ?? Logger::WARNING,
                    true,
                    $this->getConfig()['log']['permission'] ?? null
            ));
        }

        Log::setLogger($logger);
    }
1131197
public Logger getOrCreateLogger(String clazz) {
      Logger logger = appenderLoggerMap.get(clazz);
      if (logger == null) {
          // If multiple threads do the puts, that is fine as it is a one time thing
          logger = Logger.getLogger(clazz);
          appenderLoggerMap.put(clazz, logger);
      }
      return logger;
  }
459888
function Logger() {
  /**
   * Write a simple log
   * @param {String|Object} message Message of body
   * @param {...*} [params] format the message body
   */
  this.log = function (message, params) {
    if (this.level() > 1) return;
    if (arguments.length > 1) message = String.prototype.format.apply(message, Array.prototype.slice.call(arguments, 1));
    message = this._prepareMessage('LOG', message);
    console.log(message);
    this._logToFile(message);
  };

  /**
   * Write a warning log
   * @param {String|Object} message Message of body
   * @param {...*} [params] format the message body
   */
  this.warn = function (message, params) {
    if (this.level() > 2) return;
    if (arguments.length > 1) message = String.prototype.format.apply(message, Array.prototype.slice.call(arguments, 1));
    message = this._prepareMessage('WARNING', message);
    console.warn(message);
    this._logToFile(message);
  };

  /**
   * Write a debug log
   * @param {String|Object} message Message of body
   * @param {...*} [params] format the message body
   */
  this.debug = function (message, params) {
    if (this.level() > 0) return;
    if (arguments.length > 1) message = String.prototype.format.apply(message, Array.prototype.slice.call(arguments, 1));
    message = this._prepareMessage('DEBUG', message);
    console.log(message);
    this._logToFile(message);
  };


  /**
   * Write an error message
   * @param {String|Object} message Message of body
   * @param {...*} [params] format the message body
   */
  this.error = function (message, params) {
    if (this.level() > 3) return;
    if (arguments.length > 1) message = String.prototype.format.apply(message, Array.prototype.slice.call(arguments, 1));
    message = this._prepareMessage('ERROR', message);
    console.error(message);
    this._logToFile(message);
  };


  /**
   * Prepares message
   * @param type What kind of message will be prepared
   * @param message What is the message
   * @returns {String}
   * @private
   */
  this._prepareMessage = function (type, message) {
    var simple = {
      type: this.colorType(type),
      message: typeof message == 'string' ? message : os.EOL + "{0 j 4}".format(message),
      var: defaults
    };
    switch (this.get('type')) {
      case 'simple':
        return this.get('simple').format(simple);
      case 'withFile':
        return this.get('withFile').format(Object.assign(simple, this._getActiveFunction()));
      default:
        var now = new Date();
        var date = this.get('dateFormat').format({
          year: now.getFullYear(),
          month: now.getMonth() + 1,
          day: now.getDate()
        });
        var time = this.get('timeFormat').format({
          hour: now.getHours(),
          minute: now.getMinutes(),
          second: now.getSeconds()
        });
        return (this.get(this.get('type')) || "").format(Object.assign(simple, {
          date: date,
          time: time
        }, this._getActiveFunction()));
    }
  };

  /**
   * Logs to file
   * @param message
   * @private
   */
  this._logToFile = function (message) {
    var now = new Date();
    var date = this.get('fileDateFormat').format({
      year: now.getFullYear(),
      month: now.getMonth() + 1,
      day: now.getDate()
    });
    var location = path.resolve(process.cwd(), this.get('dir'), this.get('fileFormat').format({date: date}));
    fs.appendFile(location, (message + os.EOL).replace(/\x1B\[\d+m/g, ''), function() {});
  };


  /**
   * Detect recording level
   * @returns {number}
   */
  this.level = function () {
    switch (this.get('level')) {
      case 'DEBUG':
        return 0;
      case 'LOG':
        return 1;
      case 'WARN':
        return 2;
      case 'ERROR':
        return 3;
      default:
        return 0;
    }
  };

  /**
   * Colored type
   * @returns {String}
   */
  this.colorType = function (type) {
    switch (type) {
      case 'DEBUG':
        return type.yellow;
      case 'LOG':
        return type.magenta;
      case 'WARN':
        return type.cyan;
      case 'ERROR':
        return type.red;
      default:
        return type;
    }
  };


  /**
   * Changes a default setting
   * @param {String} setting
   * @param {*} value
   * @return {String}
   */
  this.set = function (setting, value) {
    return defaults[setting] = value
  };


  /**
   * Gets a default setting
   * @param {String} setting
   * @return {String}
   */
  this.get = function (setting) {
    return defaults[setting]
  };


  /**
   * Finds file name that executing
   * @param {Number} [at] Stack position
   * @returns {{file: String, line: String}}
   * @private
   */
  this._getActiveFunction = function (at) {
    var temp = {};
    var stackTraceLimit = Error.stackTraceLimit;
    var prepareStackTrace = Error.prepareStackTrace;
    Error.stackTraceLimit = Infinity;

    Error.prepareStackTrace = function (dummyObject, v8StackTrace) {
      return v8StackTrace
    };
    Error.captureStackTrace(temp);

    var stack = temp.stack[at || 3];
    Error.prepareStackTrace = prepareStackTrace;
    Error.stackTraceLimit = stackTraceLimit;

    var file = stack["getEvalOrigin"]().split(/\\|\//).pop().blue;
    var line = stack["getLineNumber"]().toString().magenta;
    return {file: file, line: line};
  };

  /**
   * Check's logging directory's existence, if not then creates
   */
  this.checkDirectory = function () {
    var location = (path.resolve(process.cwd(), this.get('dir')));
    var dirs = location.split(path.sep), root = "";

    while (dirs.length > 0) {
      var dir = dirs.shift();
      if (dir === "") root = path.sep;
      if (!fs.existsSync(root + dir)) fs.mkdirSync(root + dir);
      root += dir + path.sep;
    }
  };

  this.checkDirectory();
}
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)
593761
@Override
    public IApimanLogger createLogger(Class <?> klazz) {
        delegatedLogger = LogManager.getLogger(klazz);
        this.klazz = klazz;
        return this;
    }
888749
def init_logger
      log = Log4r::Logger.new(STANDARD_LOGGER)
      log.trunc = true

      # sanity checks since we defined log4r's dynamic levels statically
      unless (Log4r::DEBUG == DEBUG) &&
             (Log4r::INFO == INFO) &&
             (Log4r::WARN == WARN) &&
             (Log4r::ERROR == ERROR) &&
             (Log4r::FATAL == FATAL)
        raise "Logger levels do not match Log4r levels, levels may have been customized"
      end

      Log4r::Logger[STANDARD_LOGGER].level = WARN
      Log4r::Logger[STANDARD_LOGGER].trace = true

      Log4r::StderrOutputter.new :console
      Log4r::Outputter[:console].formatter = Log4r::PatternFormatter.new(:pattern => "[%l] %m")
      log.add(:console)
    end
1260010
def setup_logger(logger=None, level='INFO'):
    
    if not logger:  # if no logger exists, make one
        logger = logging.getLogger()

    if not logger.handlers:  # setup logger handlers
        channel = logging.StreamHandler()
        channel.setFormatter(log.DebugLogFormatter())

        # channel.setFormatter(log.LogFormatter())
        logger.setLevel(level)
        logger.addHandler(channel)
543812
def create_logger(name: str) -> Logger:
    
    logger = logging.getLogger(f"{PACKAGE_NAME}.{name}")
    logger.addHandler(StreamHandler())
    return logger
874335
def get_logger(cls, custom_name=None):
        """"""
        name = custom_name or cls.get_name()
        return logging.getLogger(name)
333619
def setup_logger():
    """"""
    formatter = ColoredFormatter(
        "%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s",
        datefmt=None,
        reset=True,
        log_colors={
            'DEBUG':    'cyan',
            'INFO':     'green',
            'WARNING':  'yellow',
            'ERROR':    'red',
            'CRITICAL': 'red',
        }
    )

    logger = logging.getLogger('example')
    handler = logging.StreamHandler()
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    logger.setLevel(logging.DEBUG)

    return logger
1046859
def create_logger(app: 'Quart') -> Logger:
    
    logger = getLogger('quart.app')

    if app.debug and logger.level == NOTSET:
        logger.setLevel(DEBUG)

    logger.addHandler(default_handler)
    return logger
666167
def create_logger(self):
        """"""
        name = "bors"
        if hasattr(self, "name"):
            name = self.name

        self.log = logging.getLogger(name)
        try:
            lvl = self.conf.get_log_level()
        except AttributeError:
            lvl = self.context.get("log_level", None)

        self.log.setLevel(getattr(logging, lvl, logging.INFO))