Skip to main content

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 with logging

Project details


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.11.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logutil-0.1.11-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file logutil-0.1.11.tar.gz.

File metadata

  • Download URL: logutil-0.1.11.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1015-azure

File hashes

Hashes for logutil-0.1.11.tar.gz
Algorithm Hash digest
SHA256 ef6ff83af406462720845490b7878af728c573b2c48c6410290e23a99115bede
MD5 adfbd044d59043ee02ea19c6bdee34f8
BLAKE2b-256 34504dc969132057eaa3d8413f4c30d31822a624f42e6caf6e9b6cc3971cf6b6

See more details on using hashes here.

File details

Details for the file logutil-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: logutil-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1015-azure

File hashes

Hashes for logutil-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 9d161574616c9e04bab18bdc97ba05c51814310907c7c1051f44e4e9d993a4f2
MD5 789e2fe8580b488d1d65ea951e9f7f91
BLAKE2b-256 2ee52fa436d3afe836f079b7c55c83112906762a93daea5a083a486d6ad3cbbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page