log/stream
This commit is contained in:
parent
aad5c140dd
commit
9349775193
1 changed files with 11 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
import sys
|
||||
def get_logger(name: str) -> logging.Logger:
|
||||
def get_file_logger(name: str) -> logging.Logger:
|
||||
formatter = logging.Formatter(
|
||||
"%(name)s: %(asctime)s | %(levelname)s | %(filename)s:%(lineno)s | %(process)d >>> %(message)s",
|
||||
)
|
||||
|
@ -14,3 +14,13 @@ def get_logger(name: str) -> logging.Logger:
|
|||
logger.setLevel(logging.INFO)
|
||||
#
|
||||
return logger
|
||||
def get_stream_logger() -> logging.Logger:
|
||||
out_handler = logging.StreamHandler(stream=sys.stdout)
|
||||
out_handler.setLevel(logging.INFO)
|
||||
#
|
||||
logger = logging.getLogger()
|
||||
logger.addHandler(out_handler)
|
||||
logger.setLevel(logging.INFO)
|
||||
#
|
||||
return logger
|
||||
stream = get_stream_logger()
|
||||
|
|
Loading…
Reference in a new issue