Skip to content

Commit ab87a3b

Browse files
author
Bill Prin
committed
Fix logger list_entries
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).
1 parent 5ca4294 commit ab87a3b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

gcloud/logging/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def list_entries(self, projects=None, filter_=None, order_by=None,
298298
more entries can be retrieved with another call (pass that
299299
value as ``page_token``).
300300
"""
301-
log_filter = 'logName:%s' % (self.name,)
301+
log_filter = 'logName=%s' % (self.full_name,)
302302
if filter_ is not None:
303303
filter_ = '%s AND %s' % (filter_, log_filter)
304304
else:

gcloud/logging/test_logger.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ def test_delete_w_alternate_client(self):
348348
def test_list_entries_defaults(self):
349349
LISTED = {
350350
'projects': None,
351-
'filter_': 'logName:%s' % (self.LOGGER_NAME),
351+
'filter_': 'logName=projects/%s/logs/%s' %
352+
(self.PROJECT, self.LOGGER_NAME),
352353
'order_by': None,
353354
'page_size': None,
354355
'page_token': None,
@@ -371,7 +372,8 @@ def test_list_entries_explicit(self):
371372
PAGE_SIZE = 42
372373
LISTED = {
373374
'projects': ['PROJECT1', 'PROJECT2'],
374-
'filter_': '%s AND logName:%s' % (FILTER, self.LOGGER_NAME),
375+
'filter_': '%s AND logName=projects/%s/logs/%s' %
376+
(FILTER, self.PROJECT, self.LOGGER_NAME),
375377
'order_by': DESCENDING,
376378
'page_size': PAGE_SIZE,
377379
'page_token': TOKEN,

0 commit comments

Comments
 (0)