Nhughes09
Modular architecture: logging_config.py, cloudflare_client.py, app.py for Cloudflare AI
e54f4cc
| # logging_config.py - Centralized logging configuration | |
| import logging | |
| import sys | |
| from datetime import datetime | |
| def setup_logging(): | |
| """Configure and return the application logger.""" | |
| logging.basicConfig( | |
| level=logging.DEBUG, | |
| format="%(asctime)s | %(levelname)-8s | [%(module)s.%(funcName)s] %(message)s", | |
| handlers=[logging.StreamHandler(sys.stdout)] | |
| ) | |
| return logging.getLogger("ChatbotBrain") | |
| def log_banner(logger, text): | |
| """Log a prominent banner message.""" | |
| logger.info("=" * 70) | |
| logger.info(f" {text}") | |
| logger.info("=" * 70) | |
| def log_section(logger, text): | |
| """Log a section header.""" | |
| logger.info("-" * 50) | |
| logger.info(f" >> {text}") | |
| logger.info("-" * 50) | |
| def log_startup_info(logger): | |
| """Log startup information.""" | |
| import gradio as gr | |
| log_banner(logger, "CPU CHATBOT - CLOUDFLARE AI BACKEND") | |
| logger.info(f"Timestamp: {datetime.now().isoformat()}") | |
| logger.info(f"Python: {sys.version}") | |
| logger.info(f"Gradio: {gr.__version__}") | |