This commit is contained in:
Marc Beninca 2024-09-13 16:27:04 +02:00
parent 076f654a2d
commit 12a2a82cfe
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -3,29 +3,29 @@ import sys
def get_file_logger(name: str) -> logging.Logger:
# formatter
formatter = logging.Formatter(
"%(name)s: %(asctime)s | %(levelname)s | %(filename)s:%(lineno)s | %(process)d >>> %(message)s",
)
#
# handler
out_handler = logging.StreamHandler(stream=sys.stdout)
out_handler.setFormatter(formatter)
out_handler.setLevel(logging.INFO)
#
# logger
logger = logging.getLogger(name)
logger.addHandler(out_handler)
logger.setLevel(logging.INFO)
#
return logger
def get_stream_logger(level: int) -> logging.Logger:
# handler
out_handler = logging.StreamHandler(stream=sys.stdout)
out_handler.setLevel(level)
#
# logger
logger = logging.getLogger()
logger.addHandler(out_handler)
logger.setLevel(level)
#
return logger