From c60ae6819c19c963a954271ab00e7d42ddeaa6df Mon Sep 17 00:00:00 2001 From: daspecster Date: Tue, 28 Mar 2017 11:25:26 -0400 Subject: [PATCH] Fix untested snippet examples. --- docs/logging-stdlib-usage.rst | 3 +-- logging/google/cloud/logging/handlers/handlers.py | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/logging-stdlib-usage.rst b/docs/logging-stdlib-usage.rst index 97094789295f..cba4080b5f5e 100644 --- a/docs/logging-stdlib-usage.rst +++ b/docs/logging-stdlib-usage.rst @@ -53,7 +53,7 @@ You can also exclude certain loggers: .. code-block:: python - >>> setup_logging(handler, excluded_loggers=('werkzeug',))) + >>> setup_logging(handler, excluded_loggers=('werkzeug',)) @@ -68,4 +68,3 @@ The Python logging handler can use different transports. The default is 1. :class:`google.cloud.logging.handlers.SyncTransport` this handler does a direct API call on each logging statement to write the entry. - diff --git a/logging/google/cloud/logging/handlers/handlers.py b/logging/google/cloud/logging/handlers/handlers.py index 4cf3f0cb20e9..ae66c4516ee9 100644 --- a/logging/google/cloud/logging/handlers/handlers.py +++ b/logging/google/cloud/logging/handlers/handlers.py @@ -52,6 +52,7 @@ class CloudLoggingHandler(logging.StreamHandler): .. code-block:: python + import logging import google.cloud.logging from google.cloud.logging.handlers import CloudLoggingHandler @@ -62,7 +63,7 @@ class CloudLoggingHandler(logging.StreamHandler): cloud_logger.setLevel(logging.INFO) cloud_logger.addHandler(handler) - cloud.logger.error('bad news') # API call + cloud_logger.error('bad news') # API call """ @@ -117,7 +118,7 @@ def setup_logging(handler, excluded_loggers=EXCLUDED_LOGGER_DEFAULTS, client = google.cloud.logging.Client() handler = CloudLoggingHandler(client) - google.cloud.logging.setup_logging(handler) + google.cloud.logging.handlers.setup_logging(handler) logging.getLogger().setLevel(logging.DEBUG) logging.error('bad news') # API call