financial_chatbot / logging_config.py
ahmedelbeshry's picture
Upload 23 files
7e02cc7 verified
import logging.config
def setup_logging():
logging_config = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'standard',
},
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'financial_adviser.log',
'formatter': 'standard',
},
},
'loggers': {
'': {
'handlers': ['console', 'file'],
'level': 'DEBUG',
'propagate': True,
},
},
}
logging.config.dictConfig(logging_config)
# Initialize the logger
setup_logging()
logger = logging.getLogger(__name__)