Class BackgroundThreadTransport (3.2.5)

Stay organized with collections Save and categorize content based on your preferences.
BackgroundThreadTransport(
    client,
    name,
    *,
    grace_period=5.0,
    batch_size=10,
    max_latency=0,
    resource=Resource(type="global", labels={}),
    **kwargs
)

Asynchronous transport that uses a background thread.

Inheritance

builtins.object > Transport > BackgroundThreadTransport

Methods

BackgroundThreadTransport

BackgroundThreadTransport(
    client,
    name,
    *,
    grace_period=5.0,
    batch_size=10,
    max_latency=0,
    resource=Resource(type="global", labels={}),
    **kwargs
)
Parameters
NameDescription
client logging_v2.client.Client

The Logging client.

name str

The name of the lgoger.

grace_period Optional[float]

The amount of time to wait for pending logs to be submitted when the process is shutting down.

batch_size Optional[int]

The maximum number of items to send at a time in the background thread.

max_latency Optional[float]

The amount of time to wait for new logs before sending a new batch. It is strongly recommended to keep this smaller than the grace_period. This means this is effectively the longest amount of time the background thread will hold onto log entries before sending them to the server.

resource Optional[Resource|dict]

The default monitored resource to associate with logs when not specified

flush

flush()

Submit any pending log records.

send

send(record, message, **kwargs)

Overrides Transport.send().

Parameters
NameDescription
record logging.LogRecord

Python log record that the handler was called with.

message str or dict

The message from the LogRecord after being formatted by the associated log formatters.