-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.py
More file actions
26 lines (22 loc) · 743 Bytes
/
logger.py
File metadata and controls
26 lines (22 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# healthcare_model/logger.py
import logging
import sys
from datetime import datetime
def setup_logger():
"""Simple logging setup"""
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s | %(levelname)-8s | %(name)-15s | %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
handlers=[
logging.StreamHandler(sys.stdout),
logging.FileHandler(f'healthcare_model/logs/api_{datetime.now().strftime("%Y%m%d")}.log')
]
)
# Create logs directory
from pathlib import Path
Path('healthcare_model/logs').mkdir(exist_ok=True)
logger = logging.getLogger(__name__)
logger.info("🎯 Logging system initialized")
return logger
logger = setup_logger()