Skip to content

Handler

TidyLogHandler

Generic log handler for system error streams.

Attributes:

Name Type Description
sink str | Path | TextIO

Destination for receiving logging messages.

level str

Minimum level to trace in logs. See loguru for more details.

format str

Template used for logged messages.

diagnose bool

Whether the exception trace should display the variables values to eases the debugging.

catch bool

Whether errors occurring while sink handles logs messages should be automatically caught. If True, an exception message is displayed on sys.stderr but the exception is not propagated to the caller, preventing your app to crash.

pattern property

pattern: str

Pattern for logging instance.

Parameters:

Name Type Description Default
pattern str

Template used for parsing logged messages.

required

Returns:

Type Description
str

Pattern for logging instance.

save

save() -> dict

Return configurations as dict.

Returns:

Type Description
dict

Collection of attributes for context.

Source code in src/tidy_tools/dataframe/handler.py
def save(self) -> dict:
    """
    Return configurations as dict.

    Returns
    -------
    dict
        Collection of attributes for context.
    """
    return attrs.asdict(self)

summarize

summarize() -> dict

Summarize contents at source.

Returns:

Type Description
dict

Statistics of contents at source.

Source code in src/tidy_tools/dataframe/handler.py
def summarize(self) -> dict:
    """
    Summarize contents at `source`.

    Returns
    -------
    dict
        Statistics of contents at `source`.
    """
    return dict()

TidyFileHandler

Bases: TidyLogHandler

Log handler for file streams.

TidyMemoHandler

Bases: TidyFileHandler

Log handler for serialized streams.

Attributes:

Name Type Description
serialize bool

Whether the logged message and its records should be first converted to a JSON string before being sent to the sink.