# 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": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "loguru logging intercept",
"author": "Matthew D. Scholefield",
"author_email": "matthew331199@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e6/6e/e7f6f4bf0cc6bf5335106bee2326605f44527000b5998c06e94ebf774d81/loguru-logging-intercept-0.1.4.tar.gz",
"platform": null,
"description": "# 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": "",
"summary": "Code to integrate Loguru with Python's standard logging module",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/MatthewScholefield/loguru-logging-intercept"
},
"split_keywords": [
"loguru",
"logging",
"intercept"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e66ee7f6f4bf0cc6bf5335106bee2326605f44527000b5998c06e94ebf774d81",
"md5": "716c24d631ebb8dd93f6eb0bbd201d8c",
"sha256": "3913c1a97b5074ca8ad2fea7fa50456cb50f476484a42a6f8fcc362a50630064"
},
"downloads": -1,
"filename": "loguru-logging-intercept-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "716c24d631ebb8dd93f6eb0bbd201d8c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3030,
"upload_time": "2023-10-12T18:27:09",
"upload_time_iso_8601": "2023-10-12T18:27:09.600194Z",
"url": "https://files.pythonhosted.org/packages/e6/6e/e7f6f4bf0cc6bf5335106bee2326605f44527000b5998c06e94ebf774d81/loguru-logging-intercept-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-12 18:27:09",
"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"
}