Esempio n. 1
0
def test_esc():
    assert esc('1', '2', '3') == '\033[1;2;3m'
Esempio n. 2
0
from logging import LogRecord
from typing import Any, Union

from colorlog import TTYColoredFormatter
from colorlog.escape_codes import esc, escape_codes

DEFAULT_COLORS = {
    "DEBUG": "green",
    "INFO": "",
    "WARNING": "yellow",
    "ERROR": "red",
    "CRITICAL": "red",
}

BOLD_ON = escape_codes['bold']
BOLD_OFF = esc('22')


class CustomTTYColoredFormatter(TTYColoredFormatter):
    """
    Custom log formatter which extends `colored.TTYColoredFormatter`
    by adding attributes to message arguments and coloring error
    traceback.
    """

    # copy of airflow.utils.log.timezone_aware.TimezoneAware
    default_time_format = '%Y-%m-%d %H:%M:%S%z'
    default_msec_format = '%s %03dms'

    def __init__(self, *args, **kwargs):
        kwargs["stream"] = sys.stdout or kwargs.get("stream")
Esempio n. 3
0
def test_esc():
    assert esc("1", "2", "3") == "\033[1;2;3m"