format etc

This commit is contained in:
2025-06-05 17:25:43 -05:00
parent 2415a8146d
commit 6b9c2b638a
9 changed files with 284 additions and 216 deletions

View File

@ -1,19 +1,18 @@
import logging
from logging.handlers import TimedRotatingFileHandler
logger = logging.getLogger('garflog')
logger = logging.getLogger("garflog")
logger.setLevel(logging.INFO)
formatter=logging.Formatter(
'%(asctime)s [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
formatter = logging.Formatter(
"%(asctime)s [%(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S"
)
file_handler = TimedRotatingFileHandler(
'garfbot.log',
when='midnight',
"garfbot.log",
when="midnight",
interval=1,
backupCount=7,
delay=True # Counter-intuitively, this will flush output immediately
)
delay=True, # Counter-intuitively, this will flush output immediately
)
file_handler.setFormatter(formatter)
console_handler = logging.StreamHandler()
console_handler.setFormatter(formatter)