mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Add service ID to log entry instead of module name (#588)
This commit is contained in:
parent
aebdf9444b
commit
727b6bc9d6
2 changed files with 11 additions and 1 deletions
|
|
@ -133,10 +133,14 @@ def setup_logging(args):
|
||||||
print(f"WARNING: Failed to setup Loki logging: {e}")
|
print(f"WARNING: Failed to setup Loki logging: {e}")
|
||||||
print("Continuing with console-only logging")
|
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
|
# Configure logging with all handlers
|
||||||
|
# Use processor ID as the primary identifier in logs
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=getattr(logging, log_level.upper()),
|
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,
|
handlers=handlers,
|
||||||
force=True # Force reconfiguration if already configured
|
force=True # Force reconfiguration if already configured
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,12 @@ def run():
|
||||||
description=__doc__
|
description=__doc__
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--id',
|
||||||
|
default='api-gateway',
|
||||||
|
help='Service identifier for logging and metrics (default: api-gateway)',
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--pulsar-host',
|
'-p', '--pulsar-host',
|
||||||
default=default_pulsar_host,
|
default=default_pulsar_host,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue