Data Classes

Predefined Data Classes

Data classes for parsed logs.

class zlogging._data.ASCIIInfo(path, open, close, data, exit_with_error)[source]

Bases: zlogging._data.Info

Parsed log info for ASCII logs.

The ASCII log will be stored as in this dataclass, as introduced in PEP 557.

Parameters
  • path (os.PathLike) – The value is specified in the ASCII log file under # path directive.

  • open (datetime.datetime) – The value is specified in the ASCII log file under # open directive.

  • close (datetime.datetime) – The value is specified in the ASCII log file under # close directive.

  • data (list or Model) – The log records parsed as a list of Model per line.

  • exit_with_error (bool) – When exit with error, the ASCII log file doesn’t has a # close directive.

property format

Log file format.

Type

str

Return type

Literal[“ascii”]

path: PathLike[str]

Log path.

The value is specified in the ASCII log file under # path directive.

Type

os.PathLike

open: DateTimeType

Log open time.

The value is specified in the ASCII log file under # open directive.

Type

datetime.datetime

close: DateTimeType

Log close time.

The value is specified in the ASCII log file under # close directive.

Type

datetime.datetime

data: List[Model]

Log records.

The log records parsed as a list of Model per line.

Type

list of Model

exit_with_error: bool

Log exit with error.

When exit with error, the ASCII log file doesn’t has a # close directive.

Type

bool

class zlogging._data.JSONInfo(data)[source]

Bases: zlogging._data.Info

Parsed log info for JSON logs.

The JSON log will be stored as in this dataclass, as introduced in PEP 557.

Parameters

data (list of Model) – The log records parsed as a list of Model per line.

property format

Log file format.

Type

str

Return type

Literal[“json”]

data: List[Model]

Log records.

The log records parsed as a list of Model per line.

Type

list of Model

Abstract Base Data Classes

class zlogging._data.Info[source]

Bases: object

Parsed log info.

The parsed log will be stored as in this dataclass, as introduced in PEP 557.

abstract property format

Log file format.

Type

str

Return type

str