#!/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)