8000 python-docs-samples/logging/cloud-client at kokoro-diff · owenchen/python-docs-samples · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"path":"logging/cloud-client","repo":{"id":272990582,"defaultBranch":"master","name":"python-docs-samples","ownerLogin":"owenchen","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2020-06-17T14:07:00.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/319974?v=4","public":true,"private":false,"isOrgOwned":false},"currentUser":null,"refInfo":{"name":"kokoro-diff","listCacheKey":"v0:1618748118.666945","canEdit":false,"refType":"branch","currentOid":"12409f2fc4caa81aebaf7685de1ceebab2259dc7"},"tree":{"items":[{"name":"README.rst","path":"logging/cloud-client/README.rst","contentType":"file"},{"name":"README.rst.in","path":"logging/cloud-client/README.rst.in","contentType":"file"},{"name":"export.py","path":"logging/cloud-client/export.py","contentType":"file"},{"name":"export_test.py","path":"logging/cloud-client/export_test.py","contentType":"file"},{"name":"handler.py","path":"logging/cloud-client/handler.py","contentType":"file"},{"name":"handler_test.py","path":"logging/cloud-client/handler_test.py","contentType":"file"},{"name":"quickstart.py","path":"logging/cloud-client/quickstart.py","contentType":"file"},{"name":"quickstart_test.py","path":"logging/cloud-client/quickstart_test.py","contentType":"file"},{"name":"requirements-test.txt","path":"logging/cloud-client/requirements-test.txt","contentType":"file"},{"name":"requirements.txt","path":"logging/cloud-client/requirements.txt","contentType":"file"},{"name":"snippets.py","path":"logging/cloud-client/snippets.py","contentType":"file"},{"name":"snippets_test.py","path":"logging/cloud-client/snippets_test.py","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":{"displayName":"README.rst","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eStackdriver Logging Python Samples\u003c/h1\u003e\u003ca id=\"user-content-stackdriver-logging-python-samples\" class=\"anchor\" aria-label=\"Permalink: Stackdriver Logging Python Samples\" href=\"#stackdriver-logging-python-samples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003ca href=\"https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples\u0026amp;page=editor\u0026amp;open_in_editor=logging/cloud-client/README.rst\" rel=\"nofollow\"\u003e\u003cimg alt=\"https://gstatic.com/cloudssh/images/open-btn.png\" src=\"https://camo.githubusercontent.com/4a90a81ab53e8d5a47b14891b795bb509a19a10c63100aa97e8bc8f1ab7426db/68747470733a2f2f677374617469632e636f6d2f636c6f75647373682f696d616765732f6f70656e2d62746e2e706e67\" data-canonical-src=\"https://gstatic.com/cloudssh/images/open-btn.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003cp dir=\"auto\"\u003eThis directory contains samples for \u003ca href=\"https://cloud.google.com/logging/docs\" rel=\"nofollow\"\u003eCloud Logging\u003c/a\u003e, which you can use to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services.\u003c/p\u003e\n\u003ca name=\"user-content-setup\"\u003e\u003c/a\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSetup\u003c/h2\u003e\u003ca id=\"user-content-setup\" class=\"anchor\" aria-label=\"Permalink: Setup\" href=\"#setup\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003ca name=\"user-content-authentication\"\u003e\u003c/a\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAuthentication\u003c/h3\u003e\u003ca id=\"user-content-authentication\" class=\"anchor\" aria-label=\"Permalink: Authentication\" href=\"#authentication\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis sample requires you to have authentication setup. Refer to the\n\u003ca href=\"https://cloud.google.com/docs/authentication/getting-started\" rel=\"nofollow\"\u003eAuthentication Getting Started Guide\u003c/a\u003e for instructions on setting up\ncredentials for applications.\u003c/p\u003e\n\u003ca name=\"user-content-install-dependencies\"\u003e\u003c/a\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInstall Dependencies\u003c/h3\u003e\u003ca id=\"user-content-install-dependencies\" class=\"anchor\" aria-label=\"Permalink: Install Dependencies\" href=\"#install-dependencies\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\u003cp dir=\"auto\"\u003eClone python-docs-samples and change directory to the sample directory you want to use.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git\"\u003e\u003cpre\u003e$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git\u003c/pre\u003e\u003c/div\u003e\n\u003c/blockquote\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003cp dir=\"auto\"\u003eInstall \u003ca href=\"https://pip.pypa.io/\" rel=\"nofollow\"\u003epip\u003c/a\u003e and \u003ca href=\"https://virtualenv.pypa.io/\" rel=\"nofollow\"\u003evirtualenv\u003c/a\u003e if you do not already have them. You may want to refer to the \u003ca href=\"https://cloud.google.com/python/setup\" rel=\"nofollow\"\u003ePython Development Environment Setup Guide\u003c/a\u003e for Google Cloud Platform for instructions.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003cp dir=\"auto\"\u003eCreate a virtualenv. Samples are compatible with Python 2.7 and 3.4+.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$ virtualenv env\n$ source env/bin/activate\"\u003e\u003cpre\u003e$ virtualenv env\n$ \u003cspan class=\"pl-c1\"\u003esource\u003c/span\u003e env/bin/activate\u003c/pre\u003e\u003c/div\u003e\n\u003c/blockquote\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003cp dir=\"auto\"\u003eInstall the dependencies needed to run the samples.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$ pip install -r requirements.txt\"\u003e\u003cpre\u003e$ pip install -r requirements.txt\u003c/pre\u003e\u003c/div\u003e\n\u003c/blockquote\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003ca name=\"user-content-samples\"\u003e\u003c/a\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSamples\u003c/h2\u003e\u003ca id=\"user-content-samples\" class=\"anchor\" aria-label=\"Permalink: Samples\" href=\"#samples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003ca name=\"user-content-quickstart\"\u003e\u003c/a\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eQuickstart\u003c/h3\u003e\u003ca id=\"user-content-quickstart\" class=\"anchor\" aria-label=\"Permalink: Quickstart\" href=\"#quickstart\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003ca href=\"https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples\u0026amp;page=editor\u0026amp;open_in_editor=logging/cloud-client/quickstart.py,logging/cloud-client/README.rst\" rel=\"nofollow\"\u003e\u003cimg alt=\"https://gstatic.com/cloudssh/images/open-btn.png\" src=\"https://camo.githubusercontent.com/4a90a81ab53e8d5a47b14891b795bb509a19a10c63100aa97e8bc8f1ab7426db/68747470733a2f2f677374617469632e636f6d2f636c6f75647373682f696d616765732f6f70656e2d62746e2e706e67\" data-canonical-src=\"https://gstatic.com/cloudssh/images/open-btn.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003cp dir=\"auto\"\u003eTo run this sample:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$ python quickstart.py\"\u003e\u003cpre\u003e$ python quickstart.py\u003c/pre\u003e\u003c/div\u003e\n\u003ca name=\"user-content-snippets\"\u003e\u003c/a\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSnippets\u003c/h3\u003e\u003ca id=\"user-content-snippets\" class=\"anchor\" aria-label=\"Permalink: Snippets\" href=\"#snippets\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003ca href=\"https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples\u0026amp;page=editor\u0026amp;open_in_editor=logging/cloud-client/snippets.py,logging/cloud-client/README.rst\" rel=\"nofollow\"\u003e\u003cimg alt=\"https://gstatic.com/cloudssh/images/open-btn.png\" src=\"https://camo.githubusercontent.com/4a90a81ab53e8d5a47b14891b795bb509a19a10c63100aa97e8bc8f1ab7426db/68747470733a2f2f677374617469632e636f6d2f636c6f75647373682f696d616765732f6f70656e2d62746e2e706e67\" data-canonical-src=\"https://gstatic.com/cloudssh/images/open-btn.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003cp dir=\"auto\"\u003eTo run this sample:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$ python snippets.py\n\nusage: snippets.py [-h] logger_name {list,write,delete} ...\n\nThis application demonstrates how to perform basic operations on logs and\nlog entries with Stackdriver Logging.\n\nFor more information, see the README.md under /logging and the\ndocumentation at https://cloud.google.com/logging/docs.\n\npositional arguments:\n logger_name Logger name\n {list,write,delete}\n list Lists the most recent entries for a given logger.\n write Writes log entries to the given logger.\n delete Deletes a logger and all its entries. Note that a\n deletion can take several minutes to take effect.\n\noptional arguments:\n -h, --help show this help message and exit\"\u003e\u003cpre\u003e$ python snippets.py\n\nusage: snippets.py [-h] logger_name {list,write,delete} ...\n\nThis application demonstrates how to perform basic operations on logs and\nlog entries with Stackdriver Logging.\n\nFor more information, see the README.md under /logging and the\ndocumentation at https://cloud.google.com/logging/docs.\n\npositional arguments:\n logger_name Logger name\n {list,write,delete}\n list Lists the most recent entries \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e a given logger.\n write Writes log entries to the given logger.\n delete Deletes a logger and all its entries. Note that a\n deletion can take several minutes to take effect.\n\noptional arguments:\n -h, --help show this \u003cspan class=\"pl-c1\"\u003ehelp\u003c/span\u003e message and \u003cspan class=\"pl-c1\"\u003eexit\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003ca name=\"user-content-export\"\u003e\u003c/a\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eExport\u003c/h3\u003e\u003ca id=\"user-content-export\" class=\"anchor\" aria-label=\"Permalink: Export\" href=\"#export\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003ca href=\"https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples\u0026amp;page=editor\u0026amp;open_in_editor=logging/cloud-client/export.py,logging/cloud-client/README.rst\" rel=\"nofollow\"\u003e\u003cimg alt=\"https://gstatic.com/cloudssh/images/open-btn.png\" src=\"https://camo.githubusercontent.com/4a90a81ab53e8d5a47b14891b795bb509a19a10c63100aa97e8bc8f1ab7426db/68747470733a2f2f677374617469632e636f6d2f636c6f75647373682f696d616765732f6f70656e2d62746e2e706e67\" data-canonical-src=\"https://gstatic.com/cloudssh/images/open-btn.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003cp dir=\"auto\"\u003eTo run this sample:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$ python export.py\n\nusage: export.py [-h] {list,create,update,delete} ...\n\npositional arguments:\n {list,create,update,delete}\n list Lists all sinks.\n create Lists all sinks.\n update Changes a sink's filter. The filter determines which\n logs this sink matches and will be exported to the\n destination. For example a filter of 'severity\u0026gt;=INFO'\n will send all logs that have a severity of INFO or\n greater to the destination. See https://cloud.google.c\n om/logging/docs/view/advanced_filters for more filter\n information.\n delete Deletes a sink.\n\noptional arguments:\n -h, --help show this help message and exit\"\u003e\u003cpre\u003e$ python export.py\n\nusage: export.py [-h] {list,create,update,delete} ...\n\npositional arguments:\n {list,create,update,delete}\n list Lists all sinks.\n create Lists all sinks.\n update Changes a sink\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003es filter. The filter determines which\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e logs this sink matches and will be exported to the\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e destination. For example a filter of \u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003c/span\u003eseverity\u003cspan class=\"pl-k\"\u003e\u0026gt;\u003c/span\u003e=INFO\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e will send all logs that have a severity of INFO or\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e greater to the destination. See https://cloud.google.c\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e om/logging/docs/view/advanced_filters for more filter\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e information.\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e delete Deletes a sink.\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003eoptional arguments:\u003c/span\u003e\n\u003cspan class=\"pl-s\"\u003e -h, --help show this help message and exit\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003ca name=\"user-content-the-client-library\"\u003e\u003c/a\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eThe client library\u003c/h2\u003e\u003ca id=\"user-content-the-client-library\" class=\"anchor\" aria-label=\"Permalink: The client library\" href=\"#the-client-library\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis sample uses the \u003ca href=\"https://googlecloudplatform.github.io/google-cloud-python/\" rel=\"nofollow\"\u003eGoogle Cloud Client Library for Python\u003c/a\u003e.\nYou can read the documentation for more details on API usage and use GitHub\nto \u003ca href=\"https://github.com/GoogleCloudPlatform/google-cloud-python\"\u003ebrowse the source\u003c/a\u003e and \u003ca href=\"https://github.com/GoogleCloudPlatform/google-cloud-python/issues\"\u003ereport issues\u003c/a\u003e.\u003c/p\u003e\n\n\u003c/article\u003e","errorMessage":null,"headerInfo":{"toc":[{"level":1,"text":"Stackdriver Logging Python Samples","anchor":"stackdriver-logging-python-samples","htmlText":"Stackdriver Logging Python Samples"},{"level":2,"text":"Setup","anchor":"setup","htmlText":"Setup"},{"level":3,"text":"Authentication","anchor":"authentication","htmlText":"Authentication"},{"level":3,"text":"Install Dependencies","anchor":"install-dependencies","htmlText":"Install Dependencies"},{"level":2,"text":"Samples","anchor":"samples","htmlText":"Samples"},{"level":3,"text":"Quickstart","anchor":"quickstart","htmlText":"Quickstart"},{"level":3,"text":"Snippets","anchor":"snippets","htmlText":"Snippets"},{"level":3,"text":"Export","anchor":"export","htmlText":"Export"},{"level":2,"text":"The client library","anchor":"the-client-library","htmlText":"The client library"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fowenchen%2Fpython-docs-samples%2Ftree%2Fkokoro-diff%2Flogging%2Fcloud-client"}},"totalCount":12,"showBranchInfobar":true},"fileTree":{"logging":{"items":[{"name":"cloud-client","path":"logging/cloud-client","contentType":"directory"}],"totalCount":1},"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":".kokoro","path":".kokoro","contentType":"directory"},{"name":"appengine","path":"appengine","contentType":"directory"},{"name":"asset","path":"asset","contentType":"directory"},{"name":"auth","path":"auth","contentType":"directory"},{"name":"automl","path":"automl","contentType":"directory"},{"name":"bigquery","path":"bigquery","contentType":"directory"},{"name":"bigquery_storage","path":"bigquery_storage","contentType":"directory"},{"name":"bigtable","path":"bigtable","contentType":"directory"},{"name":"blog","path":"blog","contentType":"directory"},{"name":"cdn","path":"cdn","contentType":"directory"},{"name":"cloud-sql","path":"cloud-sql","contentType":"directory"},{"name":"codelabs","path":"codelabs","contentType":"directory"},{"name":"composer","path":"composer","contentType":"directory"},{"name":"compute","path":"compute","contentType":"directory"},{"name":"container_registry","path":"container_registry","contentType":"directory"},{"name":"datacatalog","path":"datacatalog","contentType":"directory"},{"name":"dataflow","path":"dataflow","contentType":"directory"},{"name":"datalabeling","path":"datalabeling","contentType":"directory"},{"name":"dataproc","path":"dataproc","contentType":"directory"},{"name":"datastore","path":"datastore","contentType":"directory"},{"name":"dialogflow","path":"dialogflow","contentType":"directory"},{"name":"dlp","path":"dlp","contentType":"directory"},{"name":"dns","path":"dns","contentType":"directory"},{"name":"document","path":"document","contentType":"directory"},{"name":"endpoints","path":"endpoints","contentType":"directory"},{"name":"error_reporting","path":"error_reporting","contentType":"directory"},{"name":"firestore","path":"firestore","contentType":"directory"},{"name":"functions","path":"functions","contentType":"directory"},{"name":"healthcare","path":"healthcare","contentType":"directory"},{"name":"iam","path":"iam","contentType":"directory"},{"name":"iap","path":"iap","contentType":"directory"},{"name":"iot","path":"iot","contentType":"directory"},{"name":"jobs","path":"jobs","contentType":"directory"},{"name":"kms","path":"kms","contentType":"directory"},{"name":"kubernetes_engine","path":"kubernetes_engine","contentType":"directory"},{"name":"language","path":"language","contentType":"directory"},{"name":"logging","path":"logging","contentType":"directory"},{"name":"media-translation","path":"media-translation","contentType":"directory"},{"name":"memorystore","path":"memorystore","contentType":"directory"},{"name":"ml_engine","path":"ml_engine","contentType":"directory"},{"name":"monitoring","path":"monitoring","contentType":"directory"},{"name":"notebooks","path":"notebooks","contentType":"directory"},{"name":"opencensus","path":"opencensus","contentType":"directory"},{"name":"profiler","path":"profiler","contentType":"directory"},{"name":"pubsub","path":"pubsub","contentType":"directory"},{"name":"run","path":"run","contentType":"directory"},{"name":"scheduler","path":"scheduler","contentType":"directory"},{"name":"scripts","path":"scripts","contentType":"directory"},{"name":"secretmanager","path":"secretmanager","contentType":"directory"},{"name":"spanner","path":"spanner","contentType":"directory"},{"name":"speech","path":"speech","contentType":"directory"},{"name":"storage","path":"storage","contentType":"directory"},{"name":"tables","path":"tables","contentType":"directory"},{"name":"tasks","path":"tasks","contentType":"directory"},{"name":"testing","path":"testing","contentType":"directory"},{"name":"texttospeech","path":"texttospeech","contentType":"directory"},{"name":"third_party","path":"third_party","contentType":"directory"},{"name":"trace","path":"trace","contentType":"directory"},{"name":"translate","path":"translate","contentType":"directory"},{"name":"video","path":"video","contentType":"directory"},{"name":"vision","path":"vision","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"AUTHORING_GUIDE.md","path":"AUTHORING_GUIDE.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"ISSUE_TEMPLATE.md","path":"ISSUE_TEMPLATE.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"MAC_SETUP.md","path":"MAC_SETUP.md","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"favicon.ico","path":"favicon.ico","contentType":"file"},{"name":"noxfile-template.py","path":"noxfile-template.py","contentType":"file"},{"name":"noxfile_config.py","path":"noxfile_config.py","contentType":"file"},{"name":"pytest.ini","path":"pytest.ini","contentType":"file"},{"name":"renovate.json","path":"renovate.json","contentType":"file"}],"totalCount":75}},"fileTreeProcessingTime":18.316125,"foldersToFetch":[],"treeExpanded":true,"symbolsExpanded":false,"csrf_tokens":{"/owenchen/python-docs-samples/branches":{"post":"FXJ_ajrlwj3dWj2GWbUs_6aGx8DpxeaE7cbDvUahq1whdNX26wv7pDW1VBPEbsQssQmjCCm2iIoTYfUebp7Ckg"},"/owenchen/python-docs-samples/branches/fetch_and_merge/kokoro-diff":{"post":"HRVTaa4JjEJvdudx9-Ix8P8fHmKltqsSVDPMXeJl0hBq8a2C1y2jwIvOnWe408KLiC-03gdVq_nFGC9P_4ox3A"},"/owenchen/python-docs-samples/branches/fetch_and_merge/kokoro-diff?discard_changes=true":{"post":"XGsDHrH11E-64O4wrmKy2BoWgcQIxuHSgoHK3-X5i0orj_31yNH7zV5YlCbhU0GjbSYreKol4TkTqinN-BZohg"}}},"title":"python-docs-samples/logging/cloud-client at kokoro-diff · owenchen/python-docs-samples","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1b17b3e7786a.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0