Improve logging
This commit is contained in:
+2
-13
@@ -76,7 +76,7 @@ class BaseProcessor:
|
||||
# Initialize logger
|
||||
self.logger = logging.getLogger(self.log_id)
|
||||
self.logger.propagate = False
|
||||
logging_format = '%(levelname)s | %(asctime)s | %(name)s | %(message)s' # %(funcName)s(%(lineno)d)
|
||||
logging_format = '%(levelname)s | %(asctime)s | %(name)s.%(funcName)s:%(lineno)d | %(message)s'
|
||||
formatter = logging.Formatter(logging_format, datefmt = '%H:%M:%S')
|
||||
|
||||
if not self.logger.hasHandlers():
|
||||
@@ -96,17 +96,6 @@ class BaseProcessor:
|
||||
for handler in self.logger.handlers:
|
||||
handler.setFormatter(formatter)
|
||||
|
||||
def _log(self, string, status=""):
|
||||
# self.logger.warning("Use of _log is deprecated, use logger instead")
|
||||
if status == "WARNING":
|
||||
self.logger.warning(string)
|
||||
elif status == "ERROR":
|
||||
self.logger.error(string)
|
||||
elif status == "SUCCESS":
|
||||
self.logger.info(string)
|
||||
else:
|
||||
self.logger.debug(f"{string}")
|
||||
|
||||
def process(
|
||||
self,
|
||||
to_process,
|
||||
@@ -232,7 +221,7 @@ class BaseProcessor:
|
||||
return data
|
||||
else:
|
||||
self.logger.info(
|
||||
"Data for {} is already computed, skipping...".format(name_full)
|
||||
"Data for {} is already computed.".format(name_full)
|
||||
)
|
||||
|
||||
def def_rules(self):
|
||||
|
||||
Reference in New Issue
Block a user