Files
Nessa/nessa/logger.py
Dan efd6cdc0d5 Fix: Changed everything to conform to Flake8.
Fix: Added some code to fix the reconnect/disconnect error.
Docs: Added setup.cfg to set everything to be 120.
2024-05-20 09:48:34 -04:00

21 lines
648 B
Python

import logging
from logging.handlers import RotatingFileHandler
# Setup basic configuration
logging.basicConfig(
level=logging.ERROR,
format="%(asctime)s - %(name)s - " "%(levelname)s - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
# Create a rotating file handler
log_file = "nessa.log"
handler = RotatingFileHandler(log_file, maxBytes=1e6, backupCount=5)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
handler.setFormatter(formatter)
# Configure the logger
logger = logging.getLogger("Nessa")
logger.addHandler(handler)
logger.setLevel(logging.ERROR) # Set to DEBUG for comprehensive logging