18 lines
773 B
Python
18 lines
773 B
Python
import logging
|
|
from logging.handlers import RotatingFileHandler
|
|
|
|
# Setup basic configuration
|
|
logging.basicConfig(level=logging.DEBUG, # 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.DEBUG) # Set to DEBUG for comprehensive logging |