pynenc.util.log#
Module Contents#
Classes#
Logger adapter for tasks. |
|
Logger adapter for runners. |
Functions#
Creates a logger for the specified app. |
API#
- pynenc.util.log.create_logger(app: pynenc.app.Pynenc) logging.Logger[source]#
Creates a logger for the specified app.
- Parameters:
app (Pynenc) – The app instance for which the logger is created.
- Returns:
The created logger.
- Raises:
ValueError – If the logging level is invalid.
- class pynenc.util.log.TaskLoggerAdapter(logger: logging.Logger, task_id: str, invocation_id: str | None = None)[source]#
Bases:
logging.LoggerAdapterLogger adapter for tasks.
This adapter adds task and invocation context to log messages.
Initialization
Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired.
You can effectively pass keyword arguments as shown in the following example:
adapter = LoggerAdapter(someLogger, dict(p1=v1, p2=“v2”))
- class pynenc.util.log.RunnerLogAdapter(logger: logging.Logger, runner_id: str)[source]#
Bases:
logging.LoggerAdapterLogger adapter for runners.
This adapter adds runner context to log messages.
Initialization
Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired.
You can effectively pass keyword arguments as shown in the following example:
adapter = LoggerAdapter(someLogger, dict(p1=v1, p2=“v2”))