modular worker
This commit is contained in:
21
unified-worker/email-worker/logger.py
Normal file
21
unified-worker/email-worker/logger.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Structured logging for email worker
|
||||
"""
|
||||
|
||||
import threading
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def log(message: str, level: str = 'INFO', worker_name: str = 'unified-worker'):
|
||||
"""
|
||||
Structured logging with timestamp and thread info
|
||||
|
||||
Args:
|
||||
message: Log message
|
||||
level: Log level (INFO, WARNING, ERROR, SUCCESS)
|
||||
worker_name: Name of the worker component
|
||||
"""
|
||||
timestamp = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
|
||||
thread_name = threading.current_thread().name
|
||||
print(f"[{timestamp}] [{level}] [{worker_name}] [{thread_name}] {message}", flush=True)
|
||||
Reference in New Issue
Block a user