AiPmTool / app /utils /logger.py
devarshia5's picture
Upload 43 files
1def50b verified
Raw
History Blame Contribute Delete
724 Bytes
# ============================================================================
# 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__)