# Loguru Logging Intercept
[](https://pypi.org/project/loguru-logging-intercept) [](https://pypi.org/project/loguru-logging-intercept)
*Code to integrate [Loguru](https://github.com/Delgan/loguru) with Python's standard
[logging](https://docs.python.org/3/howto/logging.html) module*
[Loguru](https://github.com/Delgan/loguru) is a great alternative logging library for
Python. However, if you use (potentially external) code that already integrates with
Python's default logger, you'll get a combination of the two logging styles. This code
provides a function that sets up an intercept handler to route calls to Python's
default `logging` module to Loguru.
## Usage
Before calls that use Python's default `logging` module, call the provided
`setup_loguru_logging_intercept()` as shown below:
```python
import logging
from loguru_logging_intercept import setup_loguru_logging_intercept
def main():
setup_loguru_logging_intercept(
level=logging.DEBUG,
modules=("foo", "foo.bar", "foo.baz")
)
# Can now call functions from foo that use getLogger(__name__)
...
```
## Installation
Install via `pip`:
```bash
pip3 install loguru-logging-intercept
```
Raw data
{
"_id": null,
"home_page": "https://github.com/MatthewScholefield/loguru-logging-intercept",
"name": "loguru-logging-intercept",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "loguru logging intercept",
"author": "Matthew D. Scholefield",
"author_email": "matthew331199@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/32/9d/12d76dfcac97943d439d760acb960d423e0f2b66530d2038374c9f192afa/loguru_logging_intercept-0.1.5.tar.gz",
"platform": null,
"description": "# Loguru Logging Intercept\n\n[](https://pypi.org/project/loguru-logging-intercept) [](https://pypi.org/project/loguru-logging-intercept)\n\n*Code to integrate [Loguru](https://github.com/Delgan/loguru) with Python's standard\n[logging](https://docs.python.org/3/howto/logging.html) module*\n\n[Loguru](https://github.com/Delgan/loguru) is a great alternative logging library for\nPython. However, if you use (potentially external) code that already integrates with\nPython's default logger, you'll get a combination of the two logging styles. This code\nprovides a function that sets up an intercept handler to route calls to Python's\ndefault `logging` module to Loguru.\n\n## Usage\n\nBefore calls that use Python's default `logging` module, call the provided\n`setup_loguru_logging_intercept()` as shown below:\n\n```python\nimport logging\nfrom loguru_logging_intercept import setup_loguru_logging_intercept\n\n\ndef main():\n setup_loguru_logging_intercept(\n level=logging.DEBUG,\n modules=(\"foo\", \"foo.bar\", \"foo.baz\")\n )\n # Can now call functions from foo that use getLogger(__name__)\n\n...\n```\n\n## Installation\n\nInstall via `pip`:\n\n```bash\npip3 install loguru-logging-intercept\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Code to integrate Loguru with Python's standard logging module",
"version": "0.1.5",
"project_urls": {
"Homepage": "https://github.com/MatthewScholefield/loguru-logging-intercept"
},
"split_keywords": [
"loguru",
"logging",
"intercept"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f6ee78df4f27c14490613886d0a03959f363002cb76378266987805d92adac91",
"md5": "a711ce5134f778fd629e4cd2644efec5",
"sha256": "d0e0397fe83e4f1122cbd37bf5d73f8c878099b6fb52a236d5123654f46fc0c5"
},
"downloads": -1,
"filename": "loguru_logging_intercept-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a711ce5134f778fd629e4cd2644efec5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3548,
"upload_time": "2024-12-29T04:28:03",
"upload_time_iso_8601": "2024-12-29T04:28:03.542439Z",
"url": "https://files.pythonhosted.org/packages/f6/ee/78df4f27c14490613886d0a03959f363002cb76378266987805d92adac91/loguru_logging_intercept-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "329d12d76dfcac97943d439d760acb960d423e0f2b66530d2038374c9f192afa",
"md5": "54f816b3beb470dbe3a15797316c07e2",
"sha256": "581038bf1310fbb06cda48afbd373e72bbc01d51c4df058f49081ab7a7c5f984"
},
"downloads": -1,
"filename": "loguru_logging_intercept-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "54f816b3beb470dbe3a15797316c07e2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3194,
"upload_time": "2024-12-29T04:28:05",
"upload_time_iso_8601": "2024-12-29T04:28:05.648283Z",
"url": "https://files.pythonhosted.org/packages/32/9d/12d76dfcac97943d439d760acb960d423e0f2b66530d2038374c9f192afa/loguru_logging_intercept-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-29 04:28:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MatthewScholefield",
"github_project": "loguru-logging-intercept",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "loguru-logging-intercept"
}