Skip to main content

Minimalistic wrapper for Python logging.

Project description

Unix: Unix Build Status Windows: Windows Build Status
Metrics: Coverage Status Scrutinizer Code Quality
Usage: PyPI Version PyPI License

Overview

Every project should utilize logging, but for simple use cases, this requires a bit too much boilerplate. Instead of including all of this in your modules:

import logging 

logging.basicConfig(
    level=logging.INFO,
    format="%(levelname)s: %(name)s: %(message)s",
)

log = logging.getLogger(__name__)

def greet(name):
    log.info("Hello, %s!", name)

with this package you can simply:

import log

def greet(name):
    log.info("Hello, %s!", name)

It will produce the exact same standard library logging records behind the scenes.

Installation

$ pip install minilog

Revision History

1.1 (2018-10-26)

  • Added %(relpath)s logging format.
  • Added verbosity as init() option to work with Django admin commands.

1.0 (2018-09-27)

  • Initial stable release.

0.5 (2018-09-07)

  • Disabled automatic logging configuration when invoked by pytest.

0.4 (2018-4-28)

  • Added reset=True as init() option to replace all existing logging handlers.
  • Added exception logging API.
  • Added convenience alias: log.c, log.exc.

0.3.1 (2018-03-30)

  • Fixed bug where records were written for disabled levels.

0.3 (2018-03-15)

  • Exposed logging level constants on the log package.
  • Added log.WARN as an alias of log.WARNING.

0.2.1 (2018-03-04)

  • Removed the Python version check on installation.

0.2 (2018-03-03)

  • Added method to force logging format: log.init(format="...")
  • Added method to silenced named loggers: log.silence('requests', allow_error=True)
  • Added convenience aliases: log.d, log.i, log.w, log.e

0.1 (2018-03-03)

  • Initial release.

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

minilog-1.1.tar.gz (8.1 kB view hashes)

Uploaded Source

Built Distribution

minilog-1.1-py3-none-any.whl (9.5 kB view hashes)

Uploaded Python 3

Supported by

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