opentelemetry.exporter.cloud_logging.CloudLoggingExporter

class opentelemetry.exporter.cloud_logging.CloudLoggingExporter(project_id=None, default_log_name=None, client=None, *, structured_json_file=None)[source]

Bases: LogRecordExporter

Methods

export

Exports a batch of logs.

force_flush

Flushes any buffered logs.

pick_log_id

rtype:

str

shutdown

Shuts down the exporter.

export(batch)[source]

Exports a batch of logs.

Parameters:

batch (Sequence[ReadableLogRecord]) – The list of ReadableLogRecord objects to be exported.

Return type:

LogRecordExportResult

Returns:

The result of the export.

Raises:

Exception – This method may raise exceptions on network errors, timeouts, or other failures. Callers (i.e., log processors) should handle these exceptions to comply with OpenTelemetry error handling principles.

force_flush(timeout_millis=30000)[source]

Flushes any buffered logs.

For CloudLoggingExporter, this is a no-op as logs are exported synchronously.

Return type:

bool

shutdown()[source]

Shuts down the exporter.

Called when the SDK is shut down.