This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Don’t fight with logging …


Easy logging configuration based on environment variables.

Features:

  • Set logging level using environment variable LOG_LEVEL (defaults to ‘INFO’)
  • Set which loggers to enable using environment variable LOGGERS (defaults to ”, everything)
  • Always output to stdout
  • Completely disable logging setting LOG_LEVEL=DISABLED

Requirements:

  • Python 3.5 and beyond

Examples:

Simple applications:

# my_script.py

import belogging
belogging.load()  # this call is optional, only useful for customization

# belogging.getLogger is just a sugar to logging.getLogger, you can
# use logging.getLogger as usual (and recommended).
logger = belogging.getLogger('foobar')
logger.debug('test 1')
logger.info('test 2')

Executing:

# selecting LOG_LEVEL
$ LOG_LEVEL=DEBUG python my_script.py
# level=DEBUG message=test 1
# level=INFO message=test 2

# selecting LOGGERS
$ LOGGERS=foobar python my_script.py
# Both messages

# Both
$ LOGGERS=foobar LOG_LEVEL=INFO my_script.py
# only level=INFO message=test 2

Applications should call `belogging.load()` upon initialization. The first `__init__.py` would be a good candidate, but anything before any call to `logging` module will be fine.

Django:

In your projects `settings.py`:

import belogging
# ... settings ...
LOGGING = belogging.load()

Inside your code, just use `logging.getLogger()` as usual.

$ export LOG_LEVEL=WARNING
$ ./manage.py runserver
# It will output only logging messages with severity > WARNING

Logging follows a hierarchy, so you easily select or skip some logging messages:

$ export LOGGERS=my_app.critical_a,my_app.critical_c,my_lib
$ ./my-app.py
# "my_app.critical_b messages" will be skipped
# all messages from my_lib will show up

Note:

If you are developing a library you should not configure logging. Applications configure it, libraries only “log” messages.

Changelog:

0.0.2

  • Added LoggerDuplicationFilter and enable_duplication_filter option
  • Added belogging.getLogger (sugar to logging.getLogger)

0.0.1

  • Initial release
Release History

Release History

0.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
belogging-0.0.2-py3-none-any.whl (7.4 kB) Copy SHA256 Checksum SHA256 py3 Wheel Oct 25, 2016
belogging-0.0.2.tar.gz (4.7 kB) Copy SHA256 Checksum SHA256 Source Oct 25, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting