Exemple #1
0
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)
Exemple #2
0
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
Exemple #3
0
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)