nemo_evaluator.logging.context
#
Request context utilities for logging and tracing.
Module Contents#
Functions#
Bind a request ID to the current logging context. |
|
Get a logger with the request ID bound to it. |
|
Get the current request ID from the context variables. |
|
Context manager for binding and clearing request context. |
API#
- nemo_evaluator.logging.context.bind_request_id(request_id: str | None = None) str [source]#
Bind a request ID to the current logging context.
Args: request_id: Optional request ID. If None, a new UUID will be generated.
Returns: The request ID that was bound to the context.
- nemo_evaluator.logging.context.get_bound_logger(
- request_id: str | None = None,
- logger_name: str = None,
Get a logger with the request ID bound to it.
Args: request_id: Optional request ID. If None, a new UUID will be generated. logger_name: Optional logger name. If None, uses the calling module.
Returns: A structlog logger with the request ID bound to it.