lint/log
This commit is contained in:
parent
12a2a82cfe
commit
2663288127
1 changed files with 4 additions and 0 deletions
|
@ -1,8 +1,11 @@
|
||||||
|
"""Handle logging."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def get_file_logger(name: str) -> logging.Logger:
|
def get_file_logger(name: str) -> logging.Logger:
|
||||||
|
"""Return a file logger."""
|
||||||
# formatter
|
# formatter
|
||||||
formatter = logging.Formatter(
|
formatter = logging.Formatter(
|
||||||
"%(name)s: %(asctime)s | %(levelname)s | %(filename)s:%(lineno)s | %(process)d >>> %(message)s",
|
"%(name)s: %(asctime)s | %(levelname)s | %(filename)s:%(lineno)s | %(process)d >>> %(message)s",
|
||||||
|
@ -19,6 +22,7 @@ def get_file_logger(name: str) -> logging.Logger:
|
||||||
|
|
||||||
|
|
||||||
def get_stream_logger(level: int) -> logging.Logger:
|
def get_stream_logger(level: int) -> logging.Logger:
|
||||||
|
"""Return a stream logger."""
|
||||||
# handler
|
# handler
|
||||||
out_handler = logging.StreamHandler(stream=sys.stdout)
|
out_handler = logging.StreamHandler(stream=sys.stdout)
|
||||||
out_handler.setLevel(level)
|
out_handler.setLevel(level)
|
||||||
|
|
Loading…
Reference in a new issue