{"id":17477717,"url":"https://github.com/rai200890/python_google_cloud_logger","last_synced_at":"2025-10-24T10:40:25.083Z","repository":{"id":50198842,"uuid":"155116893","full_name":"rai200890/python_google_cloud_logger","owner":"rai200890","description":"Python log formatter according to Google Cloud v2 Specification","archived":false,"fork":false,"pushed_at":"2021-06-01T23:13:51.000Z","size":74,"stargazers_count":9,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T10:42:58.251Z","etag":null,"topics":["google-cloud-logging","logging","python3"],"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/rai200890.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-10-28T21:21:45.000Z","updated_at":"2022-02-05T03:42:25.000Z","dependencies_parsed_at":"2022-09-26T20:53:15.518Z","dependency_job_id":null,"html_url":"https://github.com/rai200890/python_google_cloud_logger","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rai200890%2Fpython_google_cloud_logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rai200890%2Fpython_google_cloud_logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rai200890%2Fpython_google_cloud_logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rai200890%2Fpython_google_cloud_logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rai200890","download_url":"https://codeload.github.com/rai200890/python_google_cloud_logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250222324,"owners_count":21394850,"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":["google-cloud-logging","logging","python3"],"created_at":"2024-10-18T20:09:10.104Z","updated_at":"2025-10-24T10:40:20.054Z","avatar_url":"https://github.com/rai200890.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python_google_cloud_logger\n\n[![CircleCI](https://circleci.com/gh/rai200890/python_google_cloud_logger.svg?style=svg\u0026circle-token=cdb4c95268aa18f240f607082833c94a700f96e9)](https://circleci.com/gh/rai200890/python_google_cloud_logger)\n[![PyPI version](https://badge.fury.io/py/google-cloud-logger.svg)](https://badge.fury.io/py/google-cloud-logger)\n[![Maintainability](https://api.codeclimate.com/v1/badges/e988f26e1590a6591d96/maintainability)](https://codeclimate.com/github/rai200890/python_google_cloud_logger/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/e988f26e1590a6591d96/test_coverage)](https://codeclimate.com/github/rai200890/python_google_cloud_logger/test_coverage)\n\nPython log formatter for Google Cloud according to [v2 specification](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) using [python-json-logger](https://github.com/madzak/python-json-logger) formatter\n\nInspired by Elixir's [logger_json](https://github.com/Nebo15/logger_json) \n\n## Instalation\n\n### Pipenv\n\n```\n    pipenv install google_cloud_logger \n```\n\n### Pip\n\n```\n    pip install google_cloud_logger \n```\n\n## Usage\n\n```python\nLOG_CONFIG = {\n    \"version\": 1,\n    \"formatters\": {\n        \"json\": {\n            \"()\": \"google_cloud_logger.GoogleCloudFormatter\",\n            \"application_info\": {\n                \"type\": \"python-application\",\n                \"name\": \"Example Application\"\n            },\n            \"format\": \"[%(asctime)s] %(levelname)s in %(module)s: %(message)s\"\n        }\n    },\n    \"handlers\": {\n        \"json\": {\n            \"class\": \"logging.StreamHandler\",\n            \"formatter\": \"json\"\n        }\n    },\n    \"loggers\": {\n        \"root\": {\n            \"level\": \"INFO\",\n            \"handlers\": [\"json\"]\n        }\n    }\n}\nimport logging\n\nfrom logging import config\n\nconfig.dictConfig(LOG_CONFIG) # load log config from dict\n\nlogger = logging.getLogger(\"root\") # get root logger instance\n\n\nlogger.info(\"farofa\", extra={\"extra\": \"extra\"}) # log message with extra arguments  \n```\n\nExample output:\n\n```json\n{\"timestamp\": \"2018-11-03T22:05:03.818000Z\", \"severity\": \"INFO\", \"message\": \"farofa\", \"labels\": {\"type\": \"python-application\", \"name\": \"Example Application\"}, \"metadata\": {\"userLabels\": {\"extra\": \"extra\"}}, \"sourceLocation\": {\"file\": \"\u003cipython-input-9-8e9384d78e2a\u003e\", \"line\": 1, \"function\": \"\u003cmodule\u003e\"}}\n```\n\n## Credits\n\nThanks [@thulio](https://github.com/thulio), [@robsonpeixoto](https://github.com/robsonpeixoto), [@ramondelemos](https://github.com/ramondelemos)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frai200890%2Fpython_google_cloud_logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frai200890%2Fpython_google_cloud_logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frai200890%2Fpython_google_cloud_logger/lists"}