Summary of entries of Classes for logging.
Classes
Client
Client to bundle configuration needed for API requests.
LogEntry
Log entry.
ProtobufEntry
Log entry with protobuf message payload.
StructEntry
Log entry with JSON payload.
TextEntry
Log entry with text payload.
AppEngineHandler
A logging handler that sends App Engine-formatted logs to Stackdriver.
DEPRECATED: use CloudLoggingHandler instead.
ContainerEngineHandler
Handler to format log messages the format expected by GKE fluent.
This handler is written to format messages for the Google Container Engine (GKE) fluentd plugin, so that metadata such as log level are properly set.
DEPRECATED: use StructuredLogHandler to write formatted logs to standard out instead.
CloudLoggingFilter
Python standard logging
Filter class to add Cloud Logging
information to each LogRecord.
When attached to a LogHandler, each incoming log will be modified
to include new Cloud Logging relevant data. This data can be manually
overwritten using the extras
argument when writing logs.
CloudLoggingHandler
Handler that directly makes Cloud Logging API calls.
This is a Python standard logging
handler using that can be used to
route Python standard logging messages directly to the Stackdriver
Logging API.
This handler is used when not in GAE or GKE environment.
This handler supports both an asynchronous and synchronous transport.
Example:
import logging
import google.cloud.logging
from google.cloud.logging_v2.handlers import CloudLoggingHandler
client = google.cloud.logging.Client()
handler = CloudLoggingHandler(client)
cloud_logger = logging.getLogger('cloudLogger')
cloud_logger.setLevel(logging.INFO)
cloud_logger.addHandler(handler)
cloud_logger.error('bad news') # API call
StructuredLogHandler
Handler to format logs into the Cloud Logging structured log format, and write them to standard output
BackgroundThreadTransport
Asynchronous transport that uses a background thread.
Transport
Base class for Google Cloud Logging handler transports.
Subclasses of Transport
must have constructors that accept a
client and name object, and must override send
.
SyncTransport
Basic sychronous transport.
Uses this library's Logging client to directly make the API call.
Batch
Context manager: collect entries to log via a single API call.
Helper returned by Logger.batch
Logger
Loggers represent named targets for log entries.
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs
Metric
Metrics represent named filters for log entries.
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics
Resource
A monitored resource identified by specifying values for all labels.
Sink
Sinks represent filtered exports for log entries.
See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks
Modules
client
Client for interacting with the Google Cloud Logging API.
entries
Log entries within the Google Cloud Logging API.
app_engine
Logging handler for App Engine Flexible
Sends logs to the Cloud Logging API with the appropriate resource and labels for App Engine logs.
container_engine
Logging handler for Google Container Engine (GKE).
Formats log messages in a JSON format, so that Kubernetes clusters with the fluentd Google Cloud plugin installed can format their log messages so that metadata such as log level is properly captured.
handlers
Python logging
handlers for Cloud Logging.
structured_log
Logging handler for printing formatted structured logs to standard output.
background_thread
Transport for Python logging handler
Uses a background worker to log to Cloud Logging asynchronously.
base
Module containing base class for logging transport.
sync
Transport for Python logging handler.
Logs directly to the Cloud Logging API with a synchronous call.
logger
Define API Loggers.
metric
Define Cloud Logging API Metrics.
resource
Monitored Resource for the Google Logging API V2.
sink
Define Cloud Logging API Sinks.