Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Making logs nicer since 2015!

Project description

Making logs nicer since 2015!

Version Downloads Travis CodeCov ReadTheDocs

Installation

sprockets.logging is available on the Python Package Index and can be installed via pip or easy_install:

pip install sprockets.logging

Requirements

  • No external requirements

Example

This examples demonstrates the most basic usage of sprockets.logging

import logging
import sys

import sprockets.logging


formatter = logging.Formatter('%(levelname)s %(message)s {%(context)s}')
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(formatter)
handler.addFilter(sprockets.logging.ContextFilter(properties=['context']))
logging.Logger.root.addHandler(handler)
logging.Logger.root.setLevel(logging.DEBUG)

# Outputs: INFO Hi there {None}
logging.info('Hi there')

# Outputs: INFO No KeyError {bah}
logging.info('No KeyError', extra={'context': 'bah'})

# Outputs: INFO Now with context! {foo}
adapted = logging.LoggerAdapter(logging.Logger.root, extra={'context': 'foo'})
adapted.info('Now with context!')

Source

sprockets.logging source is available on Github at https://github.com/sprockets/sprockets.logging

License

sprockets.logging is released under the 3-Clause BSD license.

Release history Release notifications

This version
History Node

1.3.2

History Node

1.3.1

History Node

1.3.0

History Node

1.2.1

History Node

1.2.0

History Node

1.1.0

History Node

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
sprockets.logging-1.3.2-py2.py3-none-any.whl (7.1 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Oct 2, 2015
sprockets.logging-1.3.2.tar.gz (9.2 kB) Copy SHA256 hash SHA256 Source None Oct 2, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page