Sukanth07's picture
"Updated README.md with project description, structure, setup instructions, usage, core functionality, and other details."
8f6d05a
import os
import logging
from logging.handlers import RotatingFileHandler
# Create logs directory if it doesn't exist
os.makedirs("logs", exist_ok=True)
# Configure the logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[
RotatingFileHandler("logs/application.log", maxBytes=5*1024*1024, backupCount=3), # Log rotation
logging.StreamHandler() # Log to console as well
]
)
# Function to get the logger
def get_logger(name):
return logging.getLogger(name)