mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
Moved all server files to server/
This commit is contained in:
26
server/utils/log_utils.py
Normal file
26
server/utils/log_utils.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
Utility file for logging
|
||||
"""
|
||||
|
||||
import loguru
|
||||
|
||||
|
||||
class SingletonLogger:
|
||||
"""
|
||||
Use Singleton design pattern to create a logger object and share it
|
||||
across the entire project
|
||||
"""
|
||||
__instance = None
|
||||
|
||||
@staticmethod
|
||||
def get_logger():
|
||||
"""
|
||||
Create or return the singleton instance for the SingletonLogger class
|
||||
:return: SingletonLogger instance
|
||||
"""
|
||||
if not SingletonLogger.__instance:
|
||||
SingletonLogger.__instance = loguru.logger
|
||||
return SingletonLogger.__instance
|
||||
|
||||
|
||||
LOGGER = SingletonLogger.get_logger()
|
||||
Reference in New Issue
Block a user