Skip to content

Commit

Permalink
refactor(logging): remove unnecessary blank lines in formatter classes
Browse files Browse the repository at this point in the history
Remove extra blank lines in the CustomFormatter, ConsoleFormatter,
and JSONFormatter classes for cleaner code formatting.

refactor(main): adjust log format adapter initialization

Move the initialization of the log format adapter out of the startup
event in app/main.py for better code clarity and structure. Add
logging for the current logging format at startup.
  • Loading branch information
atompie committed Nov 29, 2024
1 parent cae6028 commit 1847f33
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tracardi/service/logging/formater.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import logging



class CustomFormatter(logging.Formatter):

white = "\x1b[97m"
grey = "\x1b[37m"
yellow = "\x1b[33;20m"
Expand All @@ -26,6 +24,7 @@ def format(self, record):
formatter = logging.Formatter(log_fmt)
return formatter.format(record)


class ConsoleFormatter(logging.Formatter):
format = "%(asctime)s [%(levelname)s] %(message)s | %(name)s | %(filename)s | %(lineno)d"

Expand All @@ -43,7 +42,6 @@ def format(self, record):
return formatter.format(record)



class JSONFormatter(logging.Formatter):
def format(self, record):
# Ensure asctime and message are computed
Expand All @@ -59,4 +57,3 @@ def format(self, record):
"lineno": record.lineno,
}
return json.dumps(log_record)

0 comments on commit 1847f33

Please sign in to comment.