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 c0a7608

Browse filesBrowse files
Update logging doc tags. (GoogleCloudPlatform#1634)
1 parent f811ab4 commit c0a7608
Copy full SHA for c0a7608

File tree

Expand file treeCollapse file tree

2 files changed

+14
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-1
lines changed

‎logging/cloud-client/export.py

Copy file name to clipboardExpand all lines: logging/cloud-client/export.py
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from google.cloud import logging
2020

2121

22+
# [START logging_list_sinks]
2223
def list_sinks():
2324
"""Lists all sinks."""
2425
logging_client = logging.Client()
@@ -30,8 +31,10 @@ def list_sinks():
3031

3132
for sink in sinks:
3233
print('{}: {} -> {}'.format(sink.name, sink.filter_, sink.destination))
34+
# [END logging_list_sinks]
3335

3436

37+
# [START logging_create_sink]
3538
def create_sink(sink_name, destination_bucket, filter_):
3639
"""Creates a sink to export logs to the given Cloud Storage bucket.
3740
@@ -61,8 +64,10 @@ def create_sink(sink_name, destination_bucket, filter_):
6164

6265
sink.create()
6366
print('Created sink {}'.format(sink.name))
67+
# [END logging_create_sink]
6468

6569

70+
# [START logging_update_sink]
6671
def update_sink(sink_name, filter_):
6772
"""Changes a sink's filter.
6873
@@ -80,9 +85,10 @@ def update_sink(sink_name, filter_):
8085
sink.filter_ = filter_
8186
print('Updated sink {}'.format(sink.name))
8287
sink.update()
83-
# [END update]
88+
# [END logging_update_sink]
8489

8590

91+
# [START logging_delete_sink]
8692
def delete_sink(sink_name):
8793
"""Deletes a sink."""
8894
logging_client = logging.Client()
@@ -91,6 +97,7 @@ def delete_sink(sink_name):
9197
sink.delete()
9298

9399
print('Deleted sink {}'.format(sink.name))
100+
# [END logging_delete_sink]
94101

95102

96103
if __name__ == '__main__':

‎logging/cloud-client/snippets.py

Copy file name to clipboardExpand all lines: logging/cloud-client/snippets.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from google.cloud import logging
2727

2828

29+
# [START logging_write_log_entry]
2930
def write_entry(logger_name):
3031
"""Writes log entries to the given logger."""
3132
logging_client = logging.Client()
@@ -47,8 +48,10 @@ def write_entry(logger_name):
4748
})
4849

4950
print('Wrote logs to {}.'.format(logger.name))
51+
# [END logging_write_log_entry]
5052

5153

54+
# [START logging_list_log_entries]
5255
def list_entries(logger_name):
5356
"""Lists the most recent entries for a given logger."""
5457
logging_client = logging.Client()
@@ -60,8 +63,10 @@ def list_entries(logger_name):
6063
timestamp = entry.timestamp.isoformat()
6164
print('* {}: {}'.format
6265
(timestamp, entry.payload))
66+
# [END logging_list_log_entries]
6367

6468

69+
# [START logging_delete_log]
6570
def delete_logger(logger_name):
6671
"""Deletes a logger and all its entries.
6772
@@ -73,6 +78,7 @@ def delete_logger(logger_name):
7378
logger.delete()
7479

7580
print('Deleted all logging entries for {}'.format(logger.name))
81+
# [END logging_delete_log]
7682

7783

7884
if __name__ == '__main__':

0 commit comments

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