# Python Logging Interceptor
*Capture Python's stdlib `logging` messages and route them to other logging frameworks.*
(Modified and packaged for PyPI from Matthew Scholefield's
[loguru-logging-intercept][r1].)
Currently supported targets:
* [Loguru][r2]
**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 code for setting 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_interceptor()` as shown below:
```python
from logging_interceptor import setup_loguru_interceptor
setup_loguru_interceptor(modules=("foo", "foo.bar", "foo.baz"))
# now call functions from `foo` that use getLogger(__name__)
```
## Installation
Install via `pip`:
```bash
pip3 install logging-interceptor
```
[r1]: https://github.com/MatthewScholefield/loguru-logging-intercept
[r2]: https://github.com/Delgan/loguru
Raw data
{
"_id": null,
"home_page": "https://github.com/imcf/logging-interceptor",
"name": "logging-interceptor",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7.2,<4.0.0",
"maintainer_email": "",
"keywords": "logging,loguru",
"author": "Matthew D. Scholefield",
"author_email": "matthew331199@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f5/81/493ae002928054cb075d0e16aede958b726a58e7f5c7f4144e03583a533f/logging_interceptor-0.1.2.tar.gz",
"platform": null,
"description": "# Python Logging Interceptor\n\n*Capture Python's stdlib `logging` messages and route them to other logging frameworks.*\n\n(Modified and packaged for PyPI from Matthew Scholefield's\n[loguru-logging-intercept][r1].)\n\nCurrently supported targets:\n\n* [Loguru][r2]\n\n**Loguru** is a great alternative logging library for Python. However, if you use\n(potentially external) code that already integrates with Python's default logger, you'll\nget a combination of the two logging styles. This code provides code for setting up an\nintercept handler to route calls to Python's default `logging` module to Loguru.\n\n## Usage\n\nBefore calls that use Python's default `logging` module, call the provided\n`setup_loguru_interceptor()` as shown below:\n\n```python\nfrom logging_interceptor import setup_loguru_interceptor\n\n\nsetup_loguru_interceptor(modules=(\"foo\", \"foo.bar\", \"foo.baz\"))\n\n# now call functions from `foo` that use getLogger(__name__)\n```\n\n## Installation\n\nInstall via `pip`:\n\n```bash\npip3 install logging-interceptor\n```\n\n[r1]: https://github.com/MatthewScholefield/loguru-logging-intercept\n[r2]: https://github.com/Delgan/loguru\n",
"bugtrack_url": null,
"license": "",
"summary": "Intercept Python's standard logging and re-route the messages.",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/imcf/logging-interceptor",
"Repository": "https://github.com/imcf/logging-interceptor"
},
"split_keywords": [
"logging",
"loguru"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2f592aca8986184705bcb689a7c93d7985c499ccddb7973d31e046d601111916",
"md5": "79faac62231a2c09ce05fbc3c617a9c1",
"sha256": "dd1e1cf9e81f457427bab08f0816e1cb06e5a427667006c7aa7a0b15f11afa24"
},
"downloads": -1,
"filename": "logging_interceptor-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "79faac62231a2c09ce05fbc3c617a9c1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.2,<4.0.0",
"size": 3689,
"upload_time": "2023-06-16T15:49:48",
"upload_time_iso_8601": "2023-06-16T15:49:48.571797Z",
"url": "https://files.pythonhosted.org/packages/2f/59/2aca8986184705bcb689a7c93d7985c499ccddb7973d31e046d601111916/logging_interceptor-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f581493ae002928054cb075d0e16aede958b726a58e7f5c7f4144e03583a533f",
"md5": "77ff327e4479d98a6e0a7766f2b97b18",
"sha256": "e2186a8418ae84d922e2a57e0bb48bfd2f9737e897f784dbb7eab8808fbe0a85"
},
"downloads": -1,
"filename": "logging_interceptor-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "77ff327e4479d98a6e0a7766f2b97b18",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.2,<4.0.0",
"size": 2998,
"upload_time": "2023-06-16T15:49:50",
"upload_time_iso_8601": "2023-06-16T15:49:50.325691Z",
"url": "https://files.pythonhosted.org/packages/f5/81/493ae002928054cb075d0e16aede958b726a58e7f5c7f4144e03583a533f/logging_interceptor-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-16 15:49:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "imcf",
"github_project": "logging-interceptor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "logging-interceptor"
}