Skip to content

Commit

Permalink
Merge pull request #209 from danasmera/master
Browse files Browse the repository at this point in the history
Fix KeyError exception when project has no logs
  • Loading branch information
waprin committed Mar 2, 2016
2 parents 6da2b63 + a41a72d commit edcff80
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cloud_logging/api/list_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

# [START all]
import argparse
import sys

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

while request:
response = request.execute()
if not response:
print("No logs found in {0} project").format(project_id)
return False
for log in response['logs']:
print(log['name'])

Expand Down

0 comments on commit edcff80

Please sign in to comment.