Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 len(response)==0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use if not response:

print "No logs found in project {0}".format(project_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use print as a function.

sys.exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer just return.

for log in response['logs']:
print(log['name'])

Expand Down