Skip to content

Commit

Permalink
#26: Created a global logging instance
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Hoffmann <dominik151099@outlook.de>
  • Loading branch information
dh1542 committed Nov 13, 2024
1 parent 746e4a6 commit a8afe2b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/sdk/python/rtdip_sdk/pipelines/logging/pipeline_logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import logging

class PipelineLogger:
_logger = None

@classmethod
def get_logger(cls, name: str = "PipelineLogger") -> logging.Logger:
if cls._logger is None:
cls._logger = logging.getLogger(name)
cls._logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
cls._logger.addHandler(handler)
return cls._logger

0 comments on commit a8afe2b

Please sign in to comment.