How to suppress exit message for google cloud logging

Viewed 215

Google cloud logging is printing out this message when my (python) program exits:

Program shutting down, attempting to send 1 queued log entries to Stackdriver Logging...
Waiting up to 5 seconds.
Sent all pending logs.

I would like to suppress printing that message. Is there a config setting to control whether the message above does not get printed out when the program exits? Thank you.

1 Answers

Use SyncTransport instead of the default BackgroundThreadTransport

from google.cloud.logging_v2.handlers import CloudLoggingHandler
from google.cloud.logging_v2.handlers.transports import SyncTransport
..........
client = google.cloud.logging.Client()
handler = CloudLoggingHandler(client, name="your_log_name", transport=SyncTransport)
Related