From 38485c5a98ea9b5a5548d65afc01c7918348801d Mon Sep 17 00:00:00 2001 From: Dan Date: Sun, 5 May 2024 17:23:47 -0400 Subject: [PATCH] Did some final tweaking to the logger --- nessa/commands.py | 2 -- nessa/logger.py | 11 ++++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/nessa/commands.py b/nessa/commands.py index bb6fd4b..a3007bf 100644 --- a/nessa/commands.py +++ b/nessa/commands.py @@ -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.") diff --git a/nessa/logger.py b/nessa/logger.py index 9c62d78..a90d191 100644 --- a/nessa/logger.py +++ b/nessa/logger.py @@ -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) \ No newline at end of file +logger.setLevel(logging.DEBUG) # Set to DEBUG for comprehensive logging \ No newline at end of file