Formatting

This commit is contained in:
Kiryl
2022-06-01 16:23:53 +03:00
parent 5039417a0f
commit c0ef0b6d6e
13 changed files with 318 additions and 185 deletions

View File

@@ -20,15 +20,15 @@ class ColoredFormatter(logging.Formatter):
def format(self, record):
seq = self.MAPPING.get(record.levelname, 37) # default white
record.levelname = ('{0}{1}m{2}{3}') \
record.levelname = '{0}{1}m{2}{3}' \
.format(self.PREFIX, seq, record.levelname, self.SUFFIX)
return logging.Formatter.format(self, record)
class BookLogger:
def __init__(self, name, book_id, main_logger=None,
filemode='w+', logging_level=logging.INFO, logging_format=
'%(asctime)s - %(levelname)s - %(message)s [%(filename)s:%(lineno)d in %(funcName)s]'):
filemode='w+', logging_level=logging.INFO,
logging_format='%(asctime)s - %(levelname)s - %(message)s [%(filename)s:%(lineno)d in %(funcName)s]'):
"""
Method for Logger configuration. Logger will write to file.
:param name: name of the Logger.
@@ -107,4 +107,4 @@ class BookStatusWrapper:
self.set_status('[GENERATE]')
def set_error(self):
self.set_status('[ERROR]')
self.set_status('[ERROR]')