This commit is contained in:
2024-04-23 15:14:59 +03:00
parent f64d0a09a8
commit 0b4c0faa79
3 changed files with 10 additions and 39 deletions

View File

@@ -1,5 +1,4 @@
import logging
import colorlog
# Define the color scheme
@@ -9,6 +8,7 @@ color_scheme = {
"WARNING": "yellow",
"ERROR": "red",
"CRITICAL": "red,bg_white",
"DEFAULT": "white",
}
# Define secondary log colors
@@ -17,7 +17,7 @@ secondary_colors = {
"asctime": {"DEBUG": "cyan"},
"process": {"DEBUG": "purple"},
"module": {"DEBUG": "cyan,bg_blue"},
"funcName": {"DEBUG": "light_white,bg_blue"}, # Add this line
"funcName": {"DEBUG": "light_white,bg_blue"},
}
# Define the log format string
@@ -60,16 +60,6 @@ formatter = MultilineColoredFormatter(fmt_string, **fmt_config)
stream = logging.StreamHandler()
stream.setFormatter(formatter)
def get_colorful_logger(name="main"):
# Create and configure the logger
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
logger.addHandler(stream)
return logger
# Set up the root logger with the same formatting
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)