From 033759041a50bc1ec4e554b3692f3eba09c5c339 Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Fri, 24 Jun 2016 15:05:00 -0400 Subject: [PATCH 1/2] Add Logging to README.md. closes #1898. --- README.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.rst b/README.rst index 0cab79fee119..faff3287a049 100644 --- a/README.rst +++ b/README.rst @@ -20,12 +20,14 @@ This client supports the following Google Cloud Platform services: - `Google Cloud Pub/Sub`_ - `Google BigQuery`_ - `Google Cloud Resource Manager`_ +- `Google Cloud Logging`_ .. _Google Cloud Datastore: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-datastore .. _Google Cloud Storage: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-storage .. _Google Cloud Pub/Sub: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-pubsub .. _Google BigQuery: https://github.com/GoogleCloudPlatform/gcloud-python#google-bigquery .. _Google Cloud Resource Manager: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-resource-manager +.. _Google Cloud Logging: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-logging If you need support for other Google APIs, check out the `Google APIs Python Client library`_. @@ -194,6 +196,28 @@ manage projects using this Client Library. .. _Resource Manager documentation: https://googlecloudplatform.github.io/gcloud-python/stable/resource-manager-api.html +Google Cloud Logging +-------------------- + +`Stackdriver Logging`_ API (`Logging API docs`_) allows you to store, search, +analyze, monitor, and alert on log data and events from Google Cloud Platform. + +.. _Stackdriver Logging: https://cloud.google.com/logging/ +.. _Logging API docs: https://cloud.google.com/logging/docs/ + +.. code:: python + + from gcloud import logging + client = logging.Client() + logger = client.logger('log_name') + logger.log_text("A simple entry") # API call + + +See the ``gcloud-python`` API `logging documentation`_ to learn how to connect +to Cloud logging using this Client Library. + +.. _logging documentation: https://googlecloudplatform.github.io/gcloud-python/stable/logging-usage.html + Contributing ------------ From 3918082310f86d1494d63931e51f351fc5bc7b98 Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Mon, 27 Jun 2016 11:53:26 -0400 Subject: [PATCH 2/2] Add example of fetting log entries. --- README.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.rst b/README.rst index faff3287a049..414d2dc53b3e 100644 --- a/README.rst +++ b/README.rst @@ -212,6 +212,13 @@ analyze, monitor, and alert on log data and events from Google Cloud Platform. logger = client.logger('log_name') logger.log_text("A simple entry") # API call +Example of fetching entries: + +.. code:: python + + entries, token = logger.list_entries() + for entry in entries: + print entry.payload See the ``gcloud-python`` API `logging documentation`_ to learn how to connect to Cloud logging using this Client Library.