MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / ColoredFormatter

Class ColoredFormatter

datastudio/utils/logging.py:47–59  ·  view source on GitHub ↗

Colored formatter for console output.

Source from the content-addressed store, hash-verified

45
46
47class ColoredFormatter(logging.Formatter):
48 """Colored formatter for console output."""
49
50 def __init__(self, fmt: str = None, datefmt: str = None, use_color: bool = True):
51 super().__init__(fmt, datefmt)
52 self.use_color = use_color
53
54 def format(self, record: logging.LogRecord) -> str:
55 if self.use_color:
56 levelname = record.levelname
57 if levelname in COLORS:
58 record.levelname = f"{COLORS[levelname]}[{levelname}]{COLORS['RESET']}"
59 return super().format(record)
60
61
62@HOOKS.register_module()

Callers 7

test_init_defaultMethod · 0.90
test_init_with_formatMethod · 0.90
__init__Method · 0.85

Calls

no outgoing calls

Tested by 6

test_init_defaultMethod · 0.72
test_init_with_formatMethod · 0.72