ButlerLogRecord¶
- class lsst.daf.butler.logging.ButlerLogRecord(*, name: str, asctime: datetime, message: str, levelno: int, levelname: str, filename: str, pathname: str, lineno: int, funcName: str | None = None, process: int, processName: str, exc_info: str | None = None, MDC: dict[str, str])¶
Bases:
BaseModel
A model representing a
logging.LogRecord
.A
LogRecord
always uses the current time in its record when recreated and that makes it impossible to use it as a serialization format. Instead have a local representation of aLogRecord
that matches Butler needs.Attributes Summary
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].Metadata about the fields defined on the model, mapping of field names to [
FieldInfo
][pydantic.fields.FieldInfo].Methods Summary
format
([log_format])Format this record.
from_record
(record)Create a new instance from a
LogRecord
.Attributes Documentation
- model_config: ClassVar[ConfigDict] = {'frozen': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'MDC': FieldInfo(annotation=dict[str, str], required=True), 'asctime': FieldInfo(annotation=datetime, required=True), 'exc_info': FieldInfo(annotation=Union[str, NoneType], required=False), 'filename': FieldInfo(annotation=str, required=True), 'funcName': FieldInfo(annotation=Union[str, NoneType], required=False), 'levelname': FieldInfo(annotation=str, required=True), 'levelno': FieldInfo(annotation=int, required=True), 'lineno': FieldInfo(annotation=int, required=True), 'message': FieldInfo(annotation=str, required=True), 'name': FieldInfo(annotation=str, required=True), 'pathname': FieldInfo(annotation=str, required=True), 'process': FieldInfo(annotation=int, required=True), 'processName': FieldInfo(annotation=str, required=True)}¶
Metadata about the fields defined on the model, mapping of field names to [
FieldInfo
][pydantic.fields.FieldInfo].This replaces
Model.__fields__
from Pydantic V1.
Methods Documentation
- classmethod from_record(record: LogRecord) ButlerLogRecord ¶
Create a new instance from a
LogRecord
.- Parameters:
- record
logging.LogRecord
The record from which to extract the relevant information.
- record