Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit edcff80

Browse filesBrowse files
committed
Merge pull request GoogleCloudPlatform#209 from danasmera/master
Fix KeyError exception when project has no logs
2 parents 6da2b63 + a41a72d commit edcff80
Copy full SHA for edcff80

File tree

Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed

‎cloud_logging/api/list_logs.py

Copy file name to clipboardExpand all lines: cloud_logging/api/list_logs.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
# [START all]
2727
import argparse
28+
import sys
2829

2930
from googleapiclient import discovery
3031
from oauth2client.client import GoogleCredentials
@@ -36,6 +37,9 @@ def list_logs(project_id, logging_service):
3637

3738
while request:
3839
response = request.execute()
40+
if not response:
41+
print("No logs found in {0} project").format(project_id)
42+
return False
3943
for log in response['logs']:
4044
print(log['name'])
4145

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.