So, after reading documentation and couple of stackoverflow questions and trying it in Python 3.4 i dont get it. When does it rotate and on what conditions?
There are 2 threads, they never stop. They call this code (i know that logger is a singleton already, there's more unrelated code in Utility):
import logging
from singleton import Singleton
from logging.handlers import TimedRotatingFileHandler
class Utility(metaclass=Singleton):
def _logger(self):
logger = logging.getLogger("main")
logger.setLevel(logging.INFO)
if not logger.hasHandlers():
handler = TimedRotatingFileHandler(
filename = "info.log",
when = 's',
interval = 10,
backupCount = 10,
encoding = 'utf-8'
)
logger.addHandler(handler)
return logger
def log(self, *text):
self._logger().info(' '.join(str(t) for t in text))
Revisiting old question, just use loguru