import logging
import logzero
from logzero import logger
class Logger:
_logger = None
def __new__(cls, *args, **kwargs):
if cls._logger is None:
_logger = logzero.setup_logger(
name="logzero-sample",
logfile="test.log",
level=logging.INFO,
formatter=logzero.LogFormatter(
fmt="%(asctime)s %(levelname)s: %(message)s",
datefmt="%Y/%m/%d %H:%M:%S",
),
maxBytes=1000,
backupCount=3,
fileLoglevel=logging.INFO,
disableStderrLogger=False,
)
return _logger
from utils.loggerService import Logger
def main():
logger = Logger()
logger.info("information!")
logger.warning("warninig!")
if __name__ == "__main__":
main()