✨ Colored console output

This commit is contained in:
Gina Häußge committed 2021-07-02 16:24:30 +02:00
1 parent c355318f1a
commit d73d530600
2 files changed
+16 -3

No files matched your search

+2
View File
@@ -77,6 +77,7 @@ INSTALL_REQUIRES_PYTHON2 = [
"typing>=3.7.4.1,<4",
"enum34>=1.1.10,<1.2",
"frozendict>=1.2,<2",
"colorlog<5",
]
# Python 3 specific requirements
@@ -86,6 +87,7 @@ INSTALL_REQUIRES_PYTHON3 = [
"zeroconf>=0.24,<0.25",
"immutabledict>=1.2.0,<2",
"pathvalidate>=2.4.1,<3",
"colorlog>=5.0.1,<6",
]
# OSX specific requirements
+14 -3
View File
@@ -287,11 +287,22 @@ def init_logging(
# default logging configuration
if default_config is None:
simple_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
default_config = {
"version": 1,
"formatters": {
"simple": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
"simple": {"format": simple_format},
"colored": {
"class": "colorlog.ColoredFormatter",
"format": "%(log_color)s" + simple_format,
"log_colors": {
"DEBUG": "light_white",
"INFO": "white",
"WARNING": "yellow",
"ERROR": "red",
"CRITICAL": "bold_red",
},
"reset": True,
},
"serial": {"format": "%(asctime)s - %(message)s"},
"timings": {"format": "%(asctime)s - %(message)s"},
@@ -301,7 +312,7 @@ def init_logging(
"console": {
"class": "octoprint.logging.handlers.OctoPrintStreamHandler",
"level": "DEBUG",
"formatter": "simple",
"formatter": "colored",
"stream": "ext://sys.stdout",
},
"file": {