comparison roundup/configuration.py @ 8487:b09ef85f0da6

feat: add nanoid pkg trace_id gen and decorator for setting processName nanoid is a shorter unique id generator and faster than uuid. I truncate nanoid id's to 12 chars to make it more readable. Also added decorator to allow setting the default processName definition in the logging module. admin.py and wsgi_handler now set processName. configuration.py knows how to overide the processName if set to the default MainProcess. Updated install docs to add nanoid as optional, how to switch to different trace_id output. pydoc generated docs include logcontext module and are referenced from admin.py.
author John Rouillard <rouilj@ieee.org>
date Mon, 08 Dec 2025 00:23:14 -0500
parents f7fadbac5856
children 7142740e6547
comparison
equal deleted inserted replaced
8478:ed4ef394d5d6 8487:b09ef85f0da6
2438 return True 2438 return True
2439 2439
2440 for name, value in get_context_info(): 2440 for name, value in get_context_info():
2441 if not hasattr(record, name): 2441 if not hasattr(record, name):
2442 setattr(record, name, value) 2442 setattr(record, name, value)
2443 continue
2444 if (name == "processName" and
2445 isinstance(value, str) and
2446 getattr(record, name) == "MainProcess"):
2447 setattr(record, name, value)
2448
2443 record.pct_char = "%" 2449 record.pct_char = "%"
2444 record.ROUNDUP_CONTEXT_FILTER_CALLED = True 2450 record.ROUNDUP_CONTEXT_FILTER_CALLED = True
2445 2451
2446 if hasattr(record, "sinfo"): 2452 if hasattr(record, "sinfo"):
2447 # sinfo has to be set via extras argument to logging commands 2453 # sinfo has to be set via extras argument to logging commands

Roundup Issue Tracker: http://roundup-tracker.org/