20 lines
535 B
Python
20 lines
535 B
Python
|
|
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__)
|