Batch
(
logger
,
client
,
resource
=
None
)
Context manager: collect entries to log via a single API call.
Helper returned by Logger.batch
Parameters
logger
client
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.
Methods
commit
commit
(
client
=
None
)
Send saved log entries as a single API call.
client
Client
or NoneType
the client to use. If not passed, falls back to the client
stored on the current batch.
log_empty
log_empty
(
**
kw
)
Add a entry without payload to be logged during commit
.
kw
log_proto
log_proto
(
message
,
**
kw
)
Add a protobuf entry to be logged during commit
.
kw
message
protobuf message
the protobuf entry
log_struct
log_struct
(
info
,
**
kw
)
Add a struct entry to be logged during commit
.
kw
info
dict
the struct entry
log_text
log_text
(
text
,
**
kw
)
Add a text entry to be logged during commit
.
kw
text
str
the text entry