Skip to content

Commit 8adee1e

Browse files
Update logging example to retrieve the default handler (GoogleCloudPlatform#3691)
* Update handler.py * Update README.rst * Update handler.py Co-authored-by: Kurtis Van Gent <[email protected]>
1 parent 9fcf08a commit 8adee1e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

logging/cloud-client/README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ Stackdriver Logging Python Samples
77
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=logging/cloud-client/README.rst
88

99

10-
This directory contains samples for Stackdriver Logging. `Stackdriver Logging`_ allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services.
10+
This directory contains samples for `Cloud Logging`_, which you can use to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services.
1111

1212

1313

1414

15-
.. _Stackdriver Logging: https://cloud.google.com/logging/docs
15+
.. _Cloud Logging: https://cloud.google.com/logging/docs
1616

1717
Setup
1818
-------------------------------------------------------------------------------
@@ -165,4 +165,4 @@ to `browse the source`_ and `report issues`_.
165165
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
166166
167167
168-
.. _Google Cloud SDK: https://cloud.google.com/sdk/
168+
.. _Google Cloud SDK: https://cloud.google.com/sdk/

logging/cloud-client/handler.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717

1818
def use_logging_handler():
1919
# [START logging_handler_setup]
20-
# Imports the Google Cloud client library
20+
# Imports the Cloud Logging client library
2121
import google.cloud.logging
2222

2323
# Instantiates a client
2424
client = google.cloud.logging.Client()
2525

26-
# Connects the logger to the root logging handler; by default this captures
27-
# all logs at INFO level and higher
26+
# Retrieves a Cloud Logging handler based on the environment
27+
# you're running in and integrates the handler with the
28+
# Python logging module. By default this captures all logs
29+
# at INFO level and higher
30+
client.get_default_handler()
2831
client.setup_logging()
2932
# [END logging_handler_setup]
3033

0 commit comments

Comments
 (0)