Did some final tweaking to the logger
This commit is contained in:
@ -12,8 +12,6 @@ load_dotenv()
|
|||||||
|
|
||||||
contact_user_id = int(os.getenv("AUTHORIZED_USER_ID"))
|
contact_user_id = int(os.getenv("AUTHORIZED_USER_ID"))
|
||||||
|
|
||||||
logger = logging.getLogger('Nessa')
|
|
||||||
|
|
||||||
class ProjectCommands(app_commands.Group):
|
class ProjectCommands(app_commands.Group):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(name="project", description="Manage projects.")
|
super().__init__(name="project", description="Manage projects.")
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
import logging
|
import logging
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
|
|
||||||
# Configure basic logger
|
# Setup basic configuration
|
||||||
logging.basicConfig(level=logging.INFO,
|
logging.basicConfig(level=logging.DEBUG, # Change to DEBUG for detailed output during development
|
||||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||||
datefmt='%Y-%m-%d %H:%M:%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'
|
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')
|
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
|
|
||||||
|
# Configure the logger
|
||||||
logger = logging.getLogger('Nessa')
|
logger = logging.getLogger('Nessa')
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.DEBUG) # Set to DEBUG for comprehensive logging
|
Reference in New Issue
Block a user