Did some final tweaking to the logger

This commit is contained in:
Dan
2024-05-05 17:23:47 -04:00
parent 14d5ba091d
commit 38485c5a98
2 changed files with 6 additions and 7 deletions

View File

@ -12,8 +12,6 @@ load_dotenv()
contact_user_id = int(os.getenv("AUTHORIZED_USER_ID"))
logger = logging.getLogger('Nessa')
class ProjectCommands(app_commands.Group):
def __init__(self):
super().__init__(name="project", description="Manage projects.")

View File

@ -1,17 +1,18 @@
import logging
from logging.handlers import RotatingFileHandler
# Configure basic logger
logging.basicConfig(level=logging.INFO,
# 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 which logs even debug messages
# Create a rotating file handler
log_file = 'nessa.log'
handler = RotatingFileHandler(log_file, maxBytes=100000, backupCount=3)
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.INFO)
logger.setLevel(logging.DEBUG) # Set to DEBUG for comprehensive logging