Add service ID to log entry instead of module name (#588)

This commit is contained in:
cybermaggedon 2025-12-10 11:07:43 +00:00 committed by GitHub
parent aebdf9444b
commit 727b6bc9d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -133,10 +133,14 @@ def setup_logging(args):
print(f"WARNING: Failed to setup Loki logging: {e}")
print("Continuing with console-only logging")
# Get processor ID for log formatting (use 'unknown' if not available)
processor_id = args.get('id', 'unknown')
# Configure logging with all handlers
# Use processor ID as the primary identifier in logs
logging.basicConfig(
level=getattr(logging, log_level.upper()),
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
format=f'%(asctime)s - {processor_id} - %(levelname)s - %(message)s',
handlers=handlers,
force=True # Force reconfiguration if already configured
)