logutil


Namelogutil JSON
Version 0.1.9 PyPI version JSON
download
home_pageNone
SummaryEasy initialization of standard python logging and loguru
upload_time2024-04-24 09:50:11
maintainerNone
docs_urlNone
authorMysterious Ben
requires_python<4.0,>=3.8
licenseApache License, Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Logutil

(Extremely) easy initialization for `logging` and `loguru`

## Why

This packages makes it (extremely) easy to send `logging` and `loguru` logs to 
- streams
- files
- sentry
- pushover
- slack

## Installation

- Logging only: `pip install logutil`
- ... + loguru: `pip install logutil[loguru]`
- ... + pushover/sentry/slack: `pip install logutil[notifiers]`
- ... + loguru + pushover/sentry/slack: `pip install logutil[all]`

## Examples

### Standard python logging

```python
from logutil import init_logging, get_logging_logger
init_logging(
    name='data_feeds',
    sentry_on=True,
    sentry_dsn='<your sentry dsn string>',
    sentry_breadcramp_level='INFO',
    sentry_event_level='WARNING',
)
logger = get_logging_logger('data_feeds')
logger.info('Test INFO message (logging)')
logger.warning('Test WARNING message (logging)')
```
```
2020-07-19T12:59:18.740Z data_feeds INFO: Test INFO message (logging)
2020-07-19T12:59:18.740Z data_feeds WARNING: Test WARNING message (logging)
```

### Loguru

```python
from logutil import init_loguru, get_loguru_logger
init_loguru()
logger = get_loguru_logger(
    slack_on=True,
    slack_level='WARNING',
    slack_webhook_url='<your slack app webhook url string>',
)
logger.info('Test INFO message (loguru)')
logger.warning('Test WARNING message (loguru)')
```
```
2020-07-19T12:56:20.771Z __main__ INFO: Test INFO message (loguru)
2020-07-19T12:56:20.771Z __main__ WARNING: Test WARNING message (loguru)
```

## Notes

- Formatting is ignored for `sentry` notifications with `logging`

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "logutil",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Mysterious Ben",
    "author_email": "datascience@tuta.io",
    "download_url": "https://files.pythonhosted.org/packages/d4/eb/1a613db48e85b092fbaee1fbda1d714da8442ef084fbc1067464eb45f5be/logutil-0.1.9.tar.gz",
    "platform": null,
    "description": "# Logutil\n\n(Extremely) easy initialization for `logging` and `loguru`\n\n## Why\n\nThis packages makes it (extremely) easy to send `logging` and `loguru` logs to \n- streams\n- files\n- sentry\n- pushover\n- slack\n\n## Installation\n\n- Logging only: `pip install logutil`\n- ... + loguru: `pip install logutil[loguru]`\n- ... + pushover/sentry/slack: `pip install logutil[notifiers]`\n- ... + loguru + pushover/sentry/slack: `pip install logutil[all]`\n\n## Examples\n\n### Standard python logging\n\n```python\nfrom logutil import init_logging, get_logging_logger\ninit_logging(\n    name='data_feeds',\n    sentry_on=True,\n    sentry_dsn='<your sentry dsn string>',\n    sentry_breadcramp_level='INFO',\n    sentry_event_level='WARNING',\n)\nlogger = get_logging_logger('data_feeds')\nlogger.info('Test INFO message (logging)')\nlogger.warning('Test WARNING message (logging)')\n```\n```\n2020-07-19T12:59:18.740Z data_feeds INFO: Test INFO message (logging)\n2020-07-19T12:59:18.740Z data_feeds WARNING: Test WARNING message (logging)\n```\n\n### Loguru\n\n```python\nfrom logutil import init_loguru, get_loguru_logger\ninit_loguru()\nlogger = get_loguru_logger(\n    slack_on=True,\n    slack_level='WARNING',\n    slack_webhook_url='<your slack app webhook url string>',\n)\nlogger.info('Test INFO message (loguru)')\nlogger.warning('Test WARNING message (loguru)')\n```\n```\n2020-07-19T12:56:20.771Z __main__ INFO: Test INFO message (loguru)\n2020-07-19T12:56:20.771Z __main__ WARNING: Test WARNING message (loguru)\n```\n\n## Notes\n\n- Formatting is ignored for `sentry` notifications with `logging`\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "Easy initialization of standard python logging and loguru",
    "version": "0.1.9",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa052e6d7e632671009f5361e4c02c611b78dd9865c030337424b516e1a9f634",
                "md5": "5bb49209831d11bf4e4f045073083ecc",
                "sha256": "3489f88056c68d226a57ffd5cc47962525acd5ce564a25c198a12d0de0a13b55"
            },
            "downloads": -1,
            "filename": "logutil-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5bb49209831d11bf4e4f045073083ecc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 8885,
            "upload_time": "2024-04-24T09:50:10",
            "upload_time_iso_8601": "2024-04-24T09:50:10.130277Z",
            "url": "https://files.pythonhosted.org/packages/fa/05/2e6d7e632671009f5361e4c02c611b78dd9865c030337424b516e1a9f634/logutil-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4eb1a613db48e85b092fbaee1fbda1d714da8442ef084fbc1067464eb45f5be",
                "md5": "8fede93653ff29fedcace8d9ea21a4bd",
                "sha256": "040cab50a0797044631f882cdeebc20cb661f51be9934267130565c59797703a"
            },
            "downloads": -1,
            "filename": "logutil-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "8fede93653ff29fedcace8d9ea21a4bd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 7479,
            "upload_time": "2024-04-24T09:50:11",
            "upload_time_iso_8601": "2024-04-24T09:50:11.060277Z",
            "url": "https://files.pythonhosted.org/packages/d4/eb/1a613db48e85b092fbaee1fbda1d714da8442ef084fbc1067464eb45f5be/logutil-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-24 09:50:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "logutil"
}
        
Elapsed time: 4.77243s