-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debug logging configuration (load at runtime)
- Loading branch information
1 parent
248b668
commit 3c88f77
Showing
3 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import logging | ||
import os | ||
|
||
|
||
def filter_log(record: logging.LogRecord) -> logging.LogRecord: | ||
record.pathname = record.pathname.replace(os.getcwd() + "/", "") | ||
return record | ||
|
||
|
||
FORMATTER = logging.Formatter( | ||
"%(asctime)s - %(levelname)s (%(pathname)s::%(funcName)s::%(lineno)d): %(message)s" | ||
) | ||
HANDLER = logging.StreamHandler() | ||
HANDLER.setLevel(logging.INFO) | ||
HANDLER.setFormatter(FORMATTER) | ||
HANDLER.addFilter(filter_log) | ||
LOG = logging.getLogger(__name__) | ||
LOG.addHandler(HANDLER) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters