From 9349775193ac5f90364ce8287eb95748cd75fc19 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 10 Jun 2024 15:23:05 +0200 Subject: [PATCH] log/stream --- rwx/log/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rwx/log/__init__.py b/rwx/log/__init__.py index b951ac9..a567492 100644 --- a/rwx/log/__init__.py +++ b/rwx/log/__init__.py @@ -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()