@@ -288,7 +288,8 @@ def log_proto(self, message, client=None, labels=None, insert_id=None,
288288 the entry.
289289
290290 :type resource: :class:`~google.cloud.logging.resource.Resource`
291- :param resource: Monitored resource of the entry
291+ :param resource: Monitored resource of the entry, defaults
292+ to the global resource type.
292293
293294 :type timestamp: :class:`datetime.datetime`
294295 :param timestamp: (optional) timestamp of event being logged.
@@ -369,7 +370,12 @@ class Batch(object):
369370 :param client: The client to use.
370371
371372 :type resource: :class:`~google.cloud.logging.resource.Resource`
372- :param resource: (Optional) Monitored resource of the batch
373+ :param resource: (Optional) Monitored resource of the batch, defaults
374+ to None, which requires that every entry should have a
375+ resource specified. Since the methods used to write
376+ entries default the entry's resource to the global
377+ resource type, this parameter is only required and used
378+ if an entry resource is explicitly set to None.
373379 """
374380 def __init__ (self , logger , client , resource = None ):
375381 self .logger = logger
@@ -408,7 +414,11 @@ def log_text(self, text, labels=None, insert_id=None, severity=None,
408414 :param timestamp: (optional) timestamp of event being logged.
409415
410416 :type resource: :class:`~google.cloud.logging.resource.Resource`
411- :param resource: (Optional) Monitored resource of the entry
417+ :param resource: (Optional) Monitored resource of the entry. Defaults
418+ to the global resource type. If set to None, the
419+ resource of the batch is used for this entry. If
420+ both this resource and the Batch resource are None,
421+ the API will return an error.
412422 """
413423 self .entries .append (
414424 ('text' , text , labels , insert_id , severity , http_request ,
@@ -439,7 +449,11 @@ def log_struct(self, info, labels=None, insert_id=None, severity=None,
439449 :param timestamp: (optional) timestamp of event being logged.
440450
441451 :type resource: :class:`~google.cloud.logging.resource.Resource`
442- :param resource: (Optional) Monitored resource of the entry
452+ :param resource: (Optional) Monitored resource of the entry. Defaults
453+ to the global resource type. If set to None, the
454+ resource of the batch is used for this entry. If
455+ both this resource and the Batch resource are None,
456+ the API will return an error.
443457 """
444458 self .entries .append (
445459 ('struct' , info , labels , insert_id , severity , http_request ,
@@ -470,7 +484,11 @@ def log_proto(self, message, labels=None, insert_id=None, severity=None,
470484 :param timestamp: (optional) timestamp of event being logged.
471485
472486 :type resource: :class:`~google.cloud.logging.resource.Resource`
473- :param resource: (Optional) Monitored resource of the entry
487+ :param resource: (Optional) Monitored resource of the entry. Defaults
488+ to the global resource type. If set to None, the
489+ resource of the batch is used for this entry. If
490+ both this resource and the Batch resource are None,
491+ the API will return an error.
474492 """
475493 self .entries .append (
476494 ('proto' , message , labels , insert_id , severity , http_request ,
0 commit comments