Files

20 lines
535 B
Python
Raw Permalink Normal View History

2024-08-05 22:14:19 +01:00
import logging
import logging.handlers
import os
# Create loggings directory if it doesn't exist
if not os.path.exists('loggings'):
os.makedirs('loggings')
# Define the logging configuration
LOG_FILE = 'loggings/app.log'
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler(LOG_FILE),
logging.StreamHandler()
])
logger = logging.getLogger(__name__)