{ "info": { "author": "Takashi Matsuo", "author_email": "tmatsuo@google.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries", "Topic :: Utilities" ], "description": "cloud-pubsub-logging-python\n===========================\n\n Logging handlers for publishing the logs to Cloud Pub/Sub.\n\n|pypi| |build| |coverage|\n\nYou can use the `pubsub_logging.PubsubHandler` or `pubsub_logging.AsyncPubsubHandler` to publish the logs to `Cloud Pub/Sub`_. You can use this module with `the standard Python logging module`_. It's recommended that you use `AsyncPubsubHandler`. `PubsubHandler` exists only for backward compatibility.\n\n.. _Cloud Pub/Sub: https://cloud.google.com/pubsub/docs/\n.. _the standard Python logging module: https://docs.python.org/2/library/logging.html\n\nSupported version\n-----------------\n\nPython 2.7 and Python 3.4 are supported.\n\nInstallation\n------------\n\n::\n\n $ pip install pubsub-logging\n\nHow to use\n----------\n\nHere is an example configuration file.\n\n.. code:: ini\n\n [loggers]\n keys=root\n\n [handlers]\n keys=asyncPubsubHandler\n\n [formatters]\n keys=simpleFormatter\n\n [logger_root]\n level=NOTSET\n handlers=asyncPubsubHandler\n\n [handler_asyncPubsubHandler]\n class=pubsub_logging.AsyncPubsubHandler\n level=DEBUG\n formatter=simpleFormatter\n # Replace {project-name} and {topic-name} with actual ones.\n # The second argument indicates number of workers.\n args=('projects/{project-name}/topics/{topic-name}', 10)\n\n [formatter_simpleFormatter]\n format=%(asctime)s - %(name)s - %(levelname)s - %(message)s\n\nHow to use this config file.\n\n.. code:: python\n\n logging.config.fileConfig(os.path.join('examples', 'logging.conf'))\n logger = logging.getLogger('root')\n logger.info('My first message.')\n\nHere is a dynamic usage example.\n\n.. code:: python\n\n pubsub_handler = AsyncPubsubHandler(topic=topic)\n pubsub_handler.setFormatter(\n logging.Formatter(\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s'))\n\n logger = logging.getLogger('root')\n logger.setLevel(logging.DEBUG)\n logger.addHandler(pubsub_handler)\n logger.info('My first message.')\n\nThe logs are kept in a buffer first, then moved to the process safe queue, and then the background child processes automatically pick up and send them to Cloud Pub/Sub. The flush call blocks until all of the logs are sent to Cloud Pub/Sub.\n\nAuthentication\n--------------\n\nThe module uses the `Application Default Credentials`_. You can configure the authentication as follows.\n\n.. _Application Default Credentials: https://developers.google.com/accounts/docs/application-default-credentials\n\nAuthentication on App Engine\n----------------------------\n\nIt should work out of the box. If you're getting an authorization error, please make sure that your App Engine service account has an `Editor` or greater permission on your Cloud project.\n\nAuthentication on Google Compute Engine\n---------------------------------------\n\nWhen creating a new instance, please add the Cloud Pub/Sub scope `https://www.googleapis.com/auth/pubsub` to the service account of the instance.\n\nAuthentication anywhere else\n----------------------------\n\nAs `the documentation suggests`_, create a new service account and download its JSON key file, then set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` pointing to the JSON key file. Please note that this service account must have `Editor` or greater permissions on your Cloud project.\n\n.. _the documentation suggests: https://developers.google.com/accounts/docs/application-default-credentials#whentouse\n\n\n.. |build| image:: https://travis-ci.org/GoogleCloudPlatform/cloud-pubsub-logging-python.svg?branch=master\n :target: https://travis-ci.org/GoogleCloudPlatform/cloud-pubsub-logging-python\n.. |pypi| image:: https://img.shields.io/pypi/v/pubsub-logging.svg\n :target: https://pypi.python.org/pypi/pubsub-logging\n.. |coverage| image:: https://coveralls.io/repos/GoogleCloudPlatform/cloud-pubsub-logging-python/badge.png?branch=master\n :target: https://coveralls.io/r/GoogleCloudPlatform/cloud-pubsub-logging-python?branch=master", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/GoogleCloudPlatform/cloud-pubsub-logging-python", "keywords": null, "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "pubsub-logging", "package_url": "https://pypi.org/project/pubsub-logging/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pubsub-logging/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/GoogleCloudPlatform/cloud-pubsub-logging-python" }, "release_url": "https://pypi.org/project/pubsub-logging/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "Logging handlers for publishing the logs to Cloud Pub/Sub", "version": "0.2.1" }, "last_serial": 1517372, "releases": { "0.1.6": [ { "comment_text": "", "digests": { "md5": "fac11416996076e612911e2be0bb450d", "sha256": "9f46d47e96c8a36fcad65c67542e0a4d8cca61ae09ab178c7741fdff44829a9a" }, "downloads": -1, "filename": "pubsub-logging-0.1.6.tar.gz", "has_sig": false, "md5_digest": "fac11416996076e612911e2be0bb450d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5238, "upload_time": "2015-04-01T16:59:26", "url": "https://files.pythonhosted.org/packages/6c/74/e15307b6b6b0aab09a5456cb2a8a7e5e804623aa9a1440c84b9d300b1348/pubsub-logging-0.1.6.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "aac3d30410130bbbf04a0eb486fb7f03", "sha256": "45b003357a304015087fa9b27a0672ba687a5611923efcc343ebe7e540fde7b5" }, "downloads": -1, "filename": "pubsub-logging-0.2.0.tar.gz", "has_sig": false, "md5_digest": "aac3d30410130bbbf04a0eb486fb7f03", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6845, "upload_time": "2015-04-18T04:13:43", "url": "https://files.pythonhosted.org/packages/0e/6b/f580c8f3d73291a16f03b72d4fbf04991de51092f5abd195e835b3b8baac/pubsub-logging-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "5ee02c7c75e3c2b0c766e75a4b0f7d16", "sha256": "986de04fdc472bd306071e2783ed06fd4604ff4190f72057877aa3f0be930cbb" }, "downloads": -1, "filename": "pubsub-logging-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5ee02c7c75e3c2b0c766e75a4b0f7d16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6975, "upload_time": "2015-04-23T03:31:04", "url": "https://files.pythonhosted.org/packages/1b/5d/14708353ca131f5f746c06aaf90c9492287df2dbd755fa0ce8f9914dea82/pubsub-logging-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5ee02c7c75e3c2b0c766e75a4b0f7d16", "sha256": "986de04fdc472bd306071e2783ed06fd4604ff4190f72057877aa3f0be930cbb" }, "downloads": -1, "filename": "pubsub-logging-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5ee02c7c75e3c2b0c766e75a4b0f7d16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6975, "upload_time": "2015-04-23T03:31:04", "url": "https://files.pythonhosted.org/packages/1b/5d/14708353ca131f5f746c06aaf90c9492287df2dbd755fa0ce8f9914dea82/pubsub-logging-0.2.1.tar.gz" } ] }