log/stream

This commit is contained in:
Marc Beninca 2024-06-10 15:23:05 +02:00
parent aad5c140dd
commit 9349775193
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -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()