Files
Nessa/nessa/logger.py
2024-05-05 17:29:53 -04:00

18 lines
773 B
Python

import logging
from logging.handlers import RotatingFileHandler
# Setup basic configuration
logging.basicConfig(level=logging.ERROR, # Change to DEBUG for detailed output during development
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) # Increased file size limit and backup count
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