def setupLogging(self, taskClass, config, quantum): """Configure logging system for execution of this task. Ths method can setup logging to attach task- or quantum-specific information to log messages. Potentially this can take into accout some info from task configuration as well. Parameters ---------- taskClass : `type` Sub-class of `~lsst.pipe.base.PipelineTask`. config : `~lsst.pipe.base.PipelineTaskConfig` Configuration object for this task quantum : `~lsst.daf.butler.Quantum` Single Quantum instance. """ # include input dataIds into MDC dataIds = set(ref.dataId for ref in chain.from_iterable(quantum.predictedInputs.values())) if dataIds: if len(dataIds) == 1: Log.MDC("LABEL", str(dataIds.pop())) else: Log.MDC("LABEL", '[' + ', '.join([str(dataId) for dataId in dataIds]) + ']')
def setupLogging(self, taskDef, quantum): """Configure logging system for execution of this task. Ths method can 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. Parameters ---------- taskDef : `lsst.pipe.base.TaskDef` The task definition. quantum : `~lsst.daf.butler.Quantum` Single Quantum instance. """ # include quantum dataId and task label into MDC label = taskDef.label if quantum.dataId: label += f":{quantum.dataId}" Log.MDC("LABEL", label)