Skip to content

Commit

Permalink
dhermes comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Prin committed May 10, 2017
1 parent a2a6be2 commit ef54bc1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
3 changes: 2 additions & 1 deletion logging/google/cloud/logging/entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class _BaseEntry(object):
:type http_request: dict
:param http_request: (optional) info about HTTP request associated with
the entry
the entry.
:type resource: :class:`~google.cloud.logging.resource.Resource`
:param resource: (Optional) Monitored resource of the entry
"""
Expand Down
28 changes: 23 additions & 5 deletions logging/google/cloud/logging/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ def log_proto(self, message, client=None, labels=None, insert_id=None,
the entry.
:type resource: :class:`~google.cloud.logging.resource.Resource`
:param resource: Monitored resource of the entry
:param resource: Monitored resource of the entry, defaults
to the global resource type.
:type timestamp: :class:`datetime.datetime`
:param timestamp: (optional) timestamp of event being logged.
Expand Down Expand Up @@ -369,7 +370,12 @@ class Batch(object):
:param client: The client to use.
:type resource: :class:`~google.cloud.logging.resource.Resource`
:param resource: (Optional) Monitored resource of the batch
:param 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 and used
if an entry resource is explicitly set to None.

This comment has been minimized.

Copy link
@dhermes

dhermes May 10, 2017

Contributor

This statement is partially false. This parameter is always used in the payload if it is non-null.

This comment has been minimized.

Copy link
@waprin

waprin May 10, 2017

Contributor

Hmm ambiguous because I meant 'used' server-side, because if every entry has a resource we send it in the request but it's ignored. Will tweak it.

"""
def __init__(self, logger, client, resource=None):
self.logger = logger
Expand Down Expand Up @@ -408,7 +414,11 @@ def log_text(self, text, labels=None, insert_id=None, severity=None,
:param timestamp: (optional) timestamp of event being logged.
:type resource: :class:`~google.cloud.logging.resource.Resource`
:param resource: (Optional) Monitored resource of the entry
:param resource: (Optional) Monitored resource of the entry. Defaults
to the global resource type. If set to None, the
resource of the batch is used for this entry. If
both this resource and the Batch resource are None,
the API will return an error.
"""
self.entries.append(
('text', text, labels, insert_id, severity, http_request,
Expand Down Expand Up @@ -439,7 +449,11 @@ def log_struct(self, info, labels=None, insert_id=None, severity=None,
:param timestamp: (optional) timestamp of event being logged.
:type resource: :class:`~google.cloud.logging.resource.Resource`
:param resource: (Optional) Monitored resource of the entry
:param resource: (Optional) Monitored resource of the entry. Defaults
to the global resource type. If set to None, the
resource of the batch is used for this entry. If
both this resource and the Batch resource are None,
the API will return an error.
"""
self.entries.append(
('struct', info, labels, insert_id, severity, http_request,
Expand Down Expand Up @@ -470,7 +484,11 @@ def log_proto(self, message, labels=None, insert_id=None, severity=None,
:param timestamp: (optional) timestamp of event being logged.
:type resource: :class:`~google.cloud.logging.resource.Resource`
:param resource: (Optional) Monitored resource of the entry
:param resource: (Optional) Monitored resource of the entry. Defaults
to the global resource type. If set to None, the
resource of the batch is used for this entry. If
both this resource and the Batch resource are None,
the API will return an error.
"""
self.entries.append(
('proto', message, labels, insert_id, severity, http_request,
Expand Down

0 comments on commit ef54bc1

Please sign in to comment.