Module logger (1.12.1)

Define API Loggers.

Classes

Batch

Batch(logger, client, resource=None)

Context manager: collect entries to log via a single API call.

Helper returned by Logger.batch

Parameters
NameDescription
logger Logger

the logger to which entries will be logged.

client Client

The client to use.

resource Resource

(Optional) Monitored resource of the batch, defaults to None, which requires that every entry should have a resource specified. Since the methods used to write entries default the entry's resource to the global resource type, this parameter is only required if explicitly set to None. If no entries' resource are set to None, this parameter will be ignored on the server.

Logger

Logger(name, client, labels=None)

Loggers represent named targets for log entries.

See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs

Parameters
NameDescription
name str

the name of the logger

client Client

A client which holds credentials and project configuration for the logger (which requires a project).

labels dict

(optional) mapping of default labels for entries written via this logger.