{"id":24607776,"url":"https://github.com/mharrisb1/logging518","last_synced_at":"2025-05-05T22:22:26.445Z","repository":{"id":41976488,"uuid":"389394917","full_name":"mharrisb1/logging518","owner":"mharrisb1","description":"🪵 Configure Python's native logging library using pyproject.toml","archived":false,"fork":false,"pushed_at":"2022-04-21T12:21:04.000Z","size":66,"stargazers_count":13,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-28T22:09:52.104Z","etag":null,"topics":["logger","logging","poetry","python","toml"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/logging518/","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/mharrisb1.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":"2021-07-25T16:40:59.000Z","updated_at":"2024-12-18T08:52:32.000Z","dependencies_parsed_at":"2022-08-12T00:41:09.428Z","dependency_job_id":null,"html_url":"https://github.com/mharrisb1/logging518","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mharrisb1%2Flogging518","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mharrisb1%2Flogging518/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mharrisb1%2Flogging518/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mharrisb1%2Flogging518/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mharrisb1","download_url":"https://codeload.github.com/mharrisb1/logging518/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252584586,"owners_count":21771986,"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":["logger","logging","poetry","python","toml"],"created_at":"2025-01-24T17:48:46.672Z","updated_at":"2025-05-05T22:22:26.424Z","avatar_url":"https://github.com/mharrisb1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🪵 logging518\n\n[![PyPI version](https://badge.fury.io/py/logging518.svg)](https://badge.fury.io/py/logging518) ![PyPI - Downloads](https://img.shields.io/pypi/dm/logging518) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/logging518.svg)](https://pypi.org/project/logging518/) [![Test Matrix](https://github.com/mharrisb1/logging518/actions/workflows/test_matrix.yml/badge.svg)](https://github.com/mharrisb1/logging518/actions/workflows/test_matrix.yml)\n\nUse your pyproject.toml (or any other TOML file) to configure Python's native logging module\n\n## Usage\n\nYou can use `logging518.config.fileConfig` the same way you would use `logging.config.fileConfig` but instead of passing a ConfigParser-form file, you can pass in a TOML-form file.\n\n```python\nimport logging\nimport logging518.config  # instead of logging.config\n\nlogging518.config.fileConfig(\"pyproject.toml\")\nlogger = logging.get_logger(\"project\")\n\nlogger.info(\"Hello, log!\")\n```\n\n## Configure\n\n`logging518.config.fileConfig` simply deserializes the TOML file you pass in (using `tomli`/`tomllib`) and passes the contents to `logging.config.dictConfig`.\n\n`logging518.config.fileConfig` uses the [tool table](https://peps.python.org/pep-0518/#tool-table) in your TOML file to look up the configuration. All logging config should be defined under `tool.logging` in the tool table.\n\n```toml\n[tool.logging]\nversion = 1\ndisable_existing_loggers = true\n\n[tool.logging.loggers.project]\nlevel = \"WARNING\"\n\n[tool.logging.loggers.project.foo_module]\nlevel = \"DEBUG\"\n```\n\nThis config would be the same as:\n\n```python\nimport logging.config\n\nLOGGING_CONFIG = {\n    \"version\": 1,\n    \"disable_existing_loggers\": True,\n    \"loggers\": {\n        \"project\": {\n            \"level\": \"WARNING\"\n        },\n        \"project.foo_module\": {\n            \"level\": \"DEBUG\"\n        }\n    }\n}\n\nlogging.config.dictConfig(LOGGING_CONFIG)\n```\n\nMore examples can be found in the 👩‍🍳 [Cookbook](https://mharrisb1.github.io/logging518/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmharrisb1%2Flogging518","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmharrisb1%2Flogging518","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmharrisb1%2Flogging518/lists"}