Module background_thread (1.15.3)

Transport for Python logging handler

Uses a background worker to log to Stackdriver Logging asynchronously.

Classes

BackgroundThreadTransport

BackgroundThreadTransport(
 client, name, grace_period=5.0, batch_size=10, max_latency=0
)

Asynchronous transport that uses a background thread.

Parameters
Name Description
client Client

The Logging client.

name str

the name of the logger.

grace_period float

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

batch_size int

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

max_latency 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.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.