Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Small handler and formatter for using python logging with Redis

Project Description
Small handler and formatter for using python logging with Redis.
This is cleared and simplified version of python-redis-log by Jed Parsons, with Python3 support.

Installation

The current stable release:

pip install rlog

or:

easy_install rlog

or from source:

$ sudo python setup.py install

Usage

>>> from rlog import RedisHandler
>>> logger = logging.getLogger()
>>> logger.addHandler(RedisHandler(channel='test'))
>>> logger.warning("Spam!")
>>> logger.error("Eggs!")

Redis clients subscribed to test will get a json log record by default.

RedisHandler and RedisListHandler also accepted all redis client settings as kwargs. More info about client settings
you may find in redis-py documentation.
Custom formatters also supported, handlers accept this as formatter keyword argument. JSONFormatter from this package
used as default.
You can use the redis-cli shell that comes with redis to test this. At
the shell prompt, type subscribe my:channel (replacing with the channel
name you choose, of course). You will see subsequent log data printed in the
shell.

Also you can use it with Django:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'handlers': {
        'redis': {
            'level': 'DEBUG',
            'class': 'rlog.RedisHandler',
            'host': 'localhost',
            'password': 'redis_password',
            'port': 6379,
            'channel': 'my_amazing_logs'
        }
    },
    'loggers': {
        'django': {
            'level': 'INFO',
            'handlers': ['redis'],
            'propagate': True,
        },
    }
}

You can also simply use it with logstash.

Release History

Release History

This version
History Node

0.2

History Node

0.1

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
rlog-0.2.tar.gz (4.2 kB) Copy SHA256 Checksum SHA256 Source Nov 23, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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