{"id":18974995,"url":"https://github.com/bufferapp/stacklogging","last_synced_at":"2025-04-19T16:44:25.244Z","repository":{"id":57471007,"uuid":"149260681","full_name":"bufferapp/stacklogging","owner":"bufferapp","description":"Python logging integration with Google Cloud Stackdriver API.","archived":false,"fork":false,"pushed_at":"2020-10-01T07:04:08.000Z","size":17,"stargazers_count":12,"open_issues_count":1,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T10:23:45.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bufferapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-18T09:15:15.000Z","updated_at":"2024-11-04T21:22:52.000Z","dependencies_parsed_at":"2022-09-10T02:02:28.508Z","dependency_job_id":null,"html_url":"https://github.com/bufferapp/stacklogging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fstacklogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fstacklogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fstacklogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fstacklogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bufferapp","download_url":"https://codeload.github.com/bufferapp/stacklogging/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525139,"owners_count":21118620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T15:16:54.573Z","updated_at":"2025-04-16T09:34:23.788Z","avatar_url":"https://github.com/bufferapp.png","language":"Python","readme":"# Stacklogging\n\n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)\n[![PyPI version](https://badge.fury.io/py/mongoct.svg)](https://badge.fury.io/py/stacklogging)\n\nThis small library generates log entries that are understood by Stackdriver Logging. You won't need to authenticate in GCE. The logs emmited will be in [JSON schema understood by Stackdriver API](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) and [Stackdriver Logging](https://cloud.google.com/error-reporting/docs/formatting-error-messages).\n\n## Installation\n\nYou can use `pip` to install `stacklogging`:\n\n```bash\npip install stacklogging\n```\n\n## Usage\n\n```python\nimport stacklogging\n\nlogger = stacklogging.getLogger()\n\ndef sum(a, b):\n    logger.info(f\"Adding {a} and {b}\")\n    return a + b\n\nr = sum(2, 4)\n```\n\nThis will output a JSON like this one:\n\n```json\n{\n    \"message\": \"Adding 2 and 4\",\n    \"timestamp\": {\n        \"seconds\": 1548239928,\n        \"nanos\": 380779027\n    },\n    \"thread\": 140619343472128,\n    \"severity\": \"INFO\"\n}\n```\n\nIt is also possible to log extra fields at runtime using the `extra` parameter.\n\n```python\nlogger.info(\"message\", extra={\"from\": \"Alice\", \"to\": \"Bob\"})\n```\n\nStacklogging will add the extra keys to the final JSON:\n\n```json\n{\n    \"message\": \"Email sent\",\n    \"timestamp\": {\n        \"seconds\": 1548260191,\n        \"nanos\": 256482124\n    },\n    \"thread\": 140166127678976,\n    \"severity\": \"INFO\",\n    \"from\": \"Alice\",\n    \"to\": \"Bob\"\n}\n```\n\n## License\n\nMIT © Buffer\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufferapp%2Fstacklogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbufferapp%2Fstacklogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufferapp%2Fstacklogging/lists"}