Skip to content

Commit

Permalink
Fix logger list_entries
Browse files Browse the repository at this point in the history
logName in the v2 API expects the fully
qualified name. The colon operator is also
slower than the equal operator (no indexing)
and currently isn’t working anyway (API bug).
  • Loading branch information
Bill Prin committed Jun 9, 2016
1 parent 2da0fa7 commit 022bbac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gcloud/logging/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def list_entries(self, projects=None, filter_=None, order_by=None,
more entries can be retrieved with another call (pass that
value as ``page_token``).
"""
log_filter = 'logName:%s' % (self.name,)
log_filter = 'logName=%s' % (self.full_name,)
if filter_ is not None:
filter_ = '%s AND %s' % (filter_, log_filter)
else:
Expand Down
6 changes: 4 additions & 2 deletions gcloud/logging/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ def test_delete_w_alternate_client(self):
def test_list_entries_defaults(self):
LISTED = {
'projects': None,
'filter_': 'logName:%s' % (self.LOGGER_NAME),
'filter_': 'logName=projects/%s/logs/%s' %
(self.PROJECT, self.LOGGER_NAME),
'order_by': None,
'page_size': None,
'page_token': None,
Expand All @@ -371,7 +372,8 @@ def test_list_entries_explicit(self):
PAGE_SIZE = 42
LISTED = {
'projects': ['PROJECT1', 'PROJECT2'],
'filter_': '%s AND logName:%s' % (FILTER, self.LOGGER_NAME),
'filter_': '%s AND logName=projects/%s/logs/%s' %
(FILTER, self.PROJECT, self.LOGGER_NAME),
'order_by': DESCENDING,
'page_size': PAGE_SIZE,
'page_token': TOKEN,
Expand Down

0 comments on commit 022bbac

Please sign in to comment.