示例#1
0
文件: loggers.py 项目: eyx092/mongodb
def _get_formatter(logger_info):
    """Return formatter."""
    if "format" in logger_info:
        log_format = logger_info["format"]
    else:
        log_format = _DEFAULT_FORMAT
    return formatters.TimestampFormatter(fmt=log_format)
示例#2
0
文件: loggers.py 项目: eyx092/mongodb
def _fallback_buildlogger_handler(include_logger_name=True):
    """Return a handler that writes to stderr."""
    if include_logger_name:
        log_format = "[fallback] [%(name)s] %(message)s"
    else:
        log_format = "[fallback] %(message)s"
    formatter = formatters.TimestampFormatter(fmt=log_format)

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

    return handler
示例#3
0
文件: loggers.py 项目: eyx092/mongodb
def _add_jasper_logger_handler(logger, job_num, test_id=None):
    handler = jasper_logger.JasperHandler(logger.name, job_num, test_id)
    handler.setFormatter(formatters.TimestampFormatter(_DEFAULT_FORMAT))
    logger.addHandler(handler)