Easy initialization of standard python logging and loguru
Project description
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
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
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 withlogging
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logutil-0.1.9.tar.gz
(7.5 kB
view details)
Built Distribution
File details
Details for the file logutil-0.1.9.tar.gz
.
File metadata
- Download URL: logutil-0.1.9.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.8.18 Linux/6.5.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 040cab50a0797044631f882cdeebc20cb661f51be9934267130565c59797703a |
|
MD5 | 8fede93653ff29fedcace8d9ea21a4bd |
|
BLAKE2b-256 | d4eb1a613db48e85b092fbaee1fbda1d714da8442ef084fbc1067464eb45f5be |
File details
Details for the file logutil-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: logutil-0.1.9-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.8.18 Linux/6.5.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3489f88056c68d226a57ffd5cc47962525acd5ce564a25c198a12d0de0a13b55 |
|
MD5 | 5bb49209831d11bf4e4f045073083ecc |
|
BLAKE2b-256 | fa052e6d7e632671009f5361e4c02c611b78dd9865c030337424b516e1a9f634 |