logs-fix
Some checks failed
Deploy to core / deploy (push) Failing after 1m28s

This commit is contained in:
2024-02-20 17:49:21 +03:00
parent 0febd91b25
commit f283ea048b
2 changed files with 30 additions and 6 deletions

28
services/logger.py Normal file
View File

@@ -0,0 +1,28 @@
import logging
import colorlog
def get_colorful_logger(name):
# Создаем объект форматирования для цветовой разметки
formatter = colorlog.ColoredFormatter(
"%(log_color)s%(levelname)-8s%(reset)s %(yellow)s[%(name)s]%(reset)s %(white)s%(message)s",
log_colors={
'DEBUG': 'cyan',
'INFO': 'green',
'WARNING': 'yellow',
'ERROR': 'red',
'CRITICAL': 'red,bg_white',
},
secondary_log_colors={},
style='%'
)
# Создаем поток вывода для записи журнала
stream = logging.StreamHandler()
stream.setFormatter(formatter)
# Создаем логгер
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
logger.addHandler(stream)
return logger