Spaces:
Sleeping
Sleeping
| # ============================================================================ | |
| # LOGGING SETUP | |
| # ============================================================================ | |
| import logging | |
| import sys | |
| from app.config import Config | |
| # Fix Windows console encoding for Unicode/emojis | |
| if sys.platform == 'win32': | |
| sys.stdout.reconfigure(encoding='utf-8', errors='replace') | |
| sys.stderr.reconfigure(encoding='utf-8', errors='replace') | |
| logging.basicConfig( | |
| level=getattr(logging, Config.LOG_LEVEL), | |
| format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', | |
| handlers=[ | |
| logging.FileHandler('api.log', encoding='utf-8'), | |
| logging.StreamHandler() | |
| ] | |
| ) | |
| logger = logging.getLogger(__name__) | |