Skip to content

Commit

Permalink
Revert "Fix "broken" docs build. (googleapis#3422)"
Browse files Browse the repository at this point in the history
This reverts commit a849060.
  • Loading branch information
dhermes committed May 18, 2017
1 parent 3de5f33 commit 91bce1a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
32 changes: 32 additions & 0 deletions docs/logging-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ Authentication and Configuration
.. literalinclude:: logging_snippets.py
:start-after: [START client_create_default]
:end-before: [END client_create_default]
:dedent: 4

or pass in ``credentials`` and ``project`` explicitly

.. literalinclude:: logging_snippets.py
:start-after: [START client_create_explicit]
:end-before: [END client_create_explicit]
:dedent: 4


Writing log entries
Expand All @@ -43,18 +45,21 @@ which to associate the entries:
.. literalinclude:: logging_snippets.py
:start-after: [START logger_create]
:end-before: [END logger_create]
:dedent: 4

Write a simple text entry to the logger.

.. literalinclude:: logging_snippets.py
:start-after: [START logger_log_text]
:end-before: [END logger_log_text]
:dedent: 4

Write a dictionary entry to the logger.

.. literalinclude:: logging_snippets.py
:start-after: [START logger_log_struct]
:end-before: [END logger_log_struct]
:dedent: 4


Retrieving log entries
Expand All @@ -65,12 +70,14 @@ Fetch entries for the default project.
.. literalinclude:: logging_snippets.py
:start-after: [START client_list_entries_default]
:end-before: [END client_list_entries_default]
:dedent: 4

Fetch entries across multiple projects.

.. literalinclude:: logging_snippets.py
:start-after: [START client_list_entries_multi_project]
:end-before: [END client_list_entries_multi_project]
:dedent: 4

Filter entries retrieved using the `Advanced Logs Filters`_ syntax

Expand All @@ -81,24 +88,28 @@ Fetch entries for the default project.
.. literalinclude:: logging_snippets.py
:start-after: [START client_list_entries_filter]
:end-before: [END client_list_entries_filter]
:dedent: 4

Sort entries in descending timestamp order.

.. literalinclude:: logging_snippets.py
:start-after: [START client_list_entries_order_by]
:end-before: [END client_list_entries_order_by]
:dedent: 4

Retrieve entries in batches of 10, iterating until done.

.. literalinclude:: logging_snippets.py
:start-after: [START client_list_entries_paged]
:end-before: [END client_list_entries_paged]
:dedent: 4

Retrieve entries for a single logger, sorting in descending timestamp order:

.. literalinclude:: logging_snippets.py
:start-after: [START logger_list_entries]
:end-before: [END logger_list_entries]
:dedent: 4


Delete all entries for a logger
Expand All @@ -107,6 +118,7 @@ Delete all entries for a logger
.. literalinclude:: logging_snippets.py
:start-after: [START logger_delete]
:end-before: [END logger_delete]
:dedent: 8


Manage log metrics
Expand All @@ -120,30 +132,35 @@ List all metrics for a project:
.. literalinclude:: logging_snippets.py
:start-after: [START client_list_metrics]
:end-before: [END client_list_metrics]
:dedent: 4

Create a metric:

.. literalinclude:: logging_snippets.py
:start-after: [START metric_create]
:end-before: [END metric_create]
:dedent: 4

Refresh local information about a metric:

.. literalinclude:: logging_snippets.py
:start-after: [START metric_reload]
:end-before: [END metric_reload]
:dedent: 4

Update a metric:

.. literalinclude:: logging_snippets.py
:start-after: [START metric_update]
:end-before: [END metric_update]
:dedent: 4

Delete a metric:

.. literalinclude:: logging_snippets.py
:start-after: [START metric_delete]
:end-before: [END metric_delete]
:dedent: 4

Export log entries using sinks
------------------------------
Expand All @@ -165,12 +182,14 @@ Add ``cloud-logs@google.com`` as the owner of the bucket:
.. literalinclude:: logging_snippets.py
:start-after: [START sink_bucket_permissions]
:end-before: [END sink_bucket_permissions]
:dedent: 4

Create a Cloud Storage sink:

.. literalinclude:: logging_snippets.py
:start-after: [START sink_storage_create]
:end-before: [END sink_storage_create]
:dedent: 4


Export to BigQuery
Expand All @@ -186,12 +205,14 @@ See: `Setting permissions for BigQuery`_
.. literalinclude:: logging_snippets.py
:start-after: [START sink_dataset_permissions]
:end-before: [END sink_dataset_permissions]
:dedent: 4

Create a BigQuery sink:

.. literalinclude:: logging_snippets.py
:start-after: [START sink_bigquery_create]
:end-before: [END sink_bigquery_create]
:dedent: 4


Export to Pub/Sub
Expand All @@ -207,12 +228,14 @@ See: `Setting permissions for Pub/Sub`_
.. literalinclude:: logging_snippets.py
:start-after: [START sink_topic_permissions]
:end-before: [END sink_topic_permissions]
:dedent: 4

Create a Cloud Pub/Sub sink:

.. literalinclude:: logging_snippets.py
:start-after: [START sink_pubsub_create]
:end-before: [END sink_pubsub_create]
:dedent: 4

Manage Sinks
~~~~~~~~~~~~
Expand All @@ -222,24 +245,28 @@ List all sinks for a project:
.. literalinclude:: logging_snippets.py
:start-after: [START client_list_sinks]
:end-before: [END client_list_sinks]
:dedent: 4

Refresh local information about a sink:

.. literalinclude:: logging_snippets.py
:start-after: [START sink_reload]
:end-before: [END sink_reload]
:dedent: 4

Update a sink:

.. literalinclude:: logging_snippets.py
:start-after: [START sink_update]
:end-before: [END sink_update]
:dedent: 4

Delete a sink:

.. literalinclude:: logging_snippets.py
:start-after: [START sink_delete]
:end-before: [END sink_delete]
:dedent: 4

Integration with Python logging module
--------------------------------------
Expand All @@ -252,6 +279,7 @@ To automatically pick the default for your current environment, use
.. literalinclude:: logging_snippets.py
:start-after: [START create_default_handler]
:end-before: [END create_default_handler]
:dedent: 4

It is also possible to attach the handler to the root Python logger, so that
for example a plain ``logging.warn`` call would be sent to Stackdriver Logging,
Expand All @@ -262,6 +290,7 @@ to configure this automatically.
.. literalinclude:: logging_snippets.py
:start-after: [START setup_logging]
:end-before: [END setup_logging]
:dedent: 4

.. note::

Expand All @@ -273,6 +302,7 @@ You can also exclude certain loggers:
.. literalinclude:: logging_snippets.py
:start-after: [START setup_logging_excludes]
:end-before: [END setup_logging_excludes]
:dedent: 4

Cloud Logging Handler
=====================
Expand All @@ -286,6 +316,7 @@ which will write directly to the API.
.. literalinclude:: logging_snippets.py
:start-after: [START create_cloud_handler]
:end-before: [END create_cloud_handler]
:dedent: 4

.. note::

Expand All @@ -301,6 +332,7 @@ of the Python logger will be included in the structured log entry under the
.. literalinclude:: logging_snippets.py
:start-after: [START create_named_handler]
:end-before: [END create_named_handler]
:dedent: 4

fluentd logging handlers
========================
Expand Down
3 changes: 2 additions & 1 deletion nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def docs(session):

# Install Sphinx and also all of the google-cloud-* packages.
session.chdir(os.path.realpath(os.path.dirname(__file__)))
session.install('sphinx', 'sphinx_rtd_theme')
session.install(
'git+https://github.com/sphinx-doc/sphinx/', 'sphinx_rtd_theme')
session.install(
'core/', 'bigquery/', 'bigtable/', 'datastore/', 'dns/', 'language/',
'logging/', 'error_reporting/', 'monitoring/', 'pubsub/',
Expand Down
2 changes: 2 additions & 0 deletions pubsub/google/cloud/pubsub/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def topic(self, name, timestamp_messages=False):
.. literalinclude:: pubsub_snippets.py
:start-after: [START client_topic]
:end-before: [END client_topic]
:dedent: 4
:type name: str
:param name: the name of the topic to be constructed.
Expand All @@ -248,6 +249,7 @@ def subscription(self, name, ack_deadline=None, push_endpoint=None,
.. literalinclude:: pubsub_snippets.py
:start-after: [START client_subscription]
:end-before: [END client_subscription]
:dedent: 4
:type name: str
:param name: the name of the subscription to be constructed.
Expand Down
2 changes: 2 additions & 0 deletions storage/google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ def download_to_file(self, file_obj, client=None):
.. literalinclude:: storage_snippets.py
:start-after: [START download_to_file]
:end-before: [END download_to_file]
:dedent: 4
The ``encryption_key`` should be a str or bytes with a length of at
least 32.
Expand Down Expand Up @@ -843,6 +844,7 @@ def upload_from_file(self, file_obj, rewind=False, size=None,
.. literalinclude:: storage_snippets.py
:start-after: [START upload_from_file]
:end-before: [END upload_from_file]
:dedent: 4
The ``encryption_key`` should be a str or bytes with a length of at
least 32.
Expand Down

0 comments on commit 91bce1a

Please sign in to comment.