LogCapture¶
- class lsst.pipe.base.log_capture.LogCapture(butler: LimitedButler, full_butler: Butler | None)¶
Bases:
objectClass handling capture of logging messages and their export to butler.
- Parameters:
- butler
LimitedButler Data butler with limited API.
- full_butler
ButlerorNone Data butler with full API, or
Noneif full Butler is not available. If not none, then this must be the same instance asbutler.
- butler
Attributes Summary
If True each log record is written to a temporary file and ingested when quantum completes.
Methods Summary
capture_logging(task_node, /, quantum[, records])Configure logging system to capture logs for execution of this task.
from_full(butler)from_limited(butler)Attributes Documentation
- stream_json_logs = True¶
If True each log record is written to a temporary file and ingested when quantum completes. If False the records are accumulated in memory and stored in butler on quantum completion. If full butler is not available then temporary file is not used.
Methods Documentation
- capture_logging(task_node: TaskNode, /, quantum: Quantum, records: ButlerLogRecords | None = None) Iterator[_LogCaptureContext]¶
Configure logging system to capture logs for execution of this task.
- Parameters:
- task_node
TaskNode The task definition.
- quantum
Quantum Single Quantum instance.
- records
lsst.daf.butler.logging.ButlerLogRecords, optional Log record container to append to and save. If provided, streaming mode is disabled (since we’ll be saving logs in memory anyway).
- task_node
Notes
Expected to be used as a context manager to ensure that logging records are inserted into the butler once the quantum has been executed:
with self.capture_logging(task_node, quantum): # Run quantum and capture logs.
Ths method can also setup logging to attach task- or quantum-specific information to log messages. Potentially this can take into account some info from task configuration as well.
- classmethod from_full(butler: Butler) LogCapture¶
- classmethod from_limited(butler: LimitedButler) LogCapture¶