−#
This commit is contained in:
parent
c702283696
commit
aad5c140dd
1 changed files with 3 additions and 9 deletions
|
@ -1,22 +1,16 @@
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def get_logger(name: str) -> logging.Logger:
|
def get_logger(name: str) -> logging.Logger:
|
||||||
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",
|
||||||
)
|
)
|
||||||
|
#
|
||||||
# file_handler = logging.FileHandler('log.txt')
|
|
||||||
# file_handler.setFormatter(formatter)
|
|
||||||
# file_handler.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
out_handler = logging.StreamHandler(stream=sys.stdout)
|
out_handler = logging.StreamHandler(stream=sys.stdout)
|
||||||
out_handler.setFormatter(formatter)
|
out_handler.setFormatter(formatter)
|
||||||
out_handler.setLevel(logging.INFO)
|
out_handler.setLevel(logging.INFO)
|
||||||
|
#
|
||||||
logger = logging.getLogger(name)
|
logger = logging.getLogger(name)
|
||||||
# logger.addHandler(file_handler)
|
|
||||||
logger.addHandler(out_handler)
|
logger.addHandler(out_handler)
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
#
|
||||||
return logger
|
return logger
|
||||||
|
|
Loading…
Reference in a new issue