RedisLog - A Redis Pub/Sub Logging Handler for Python
A logging handler for Python that publishes log messages using redis’s pub/sub system. You can use this to read or respond to streaming log data in real time.
Installation
The current stable release
easy_install python-redis-log
The latest from github
git clone git://github.com/jedp/python-redis-log.git cd python-redis-log python setup.py build python setup.py install --prefix=$HOME # for example
Requirements
The Python redis client by Andy McCurdy
Usage
>>> from redislog import handlers, logger
>>> l = logger.RedisLogger('my.logger')
>>> l.addHandler(handlers.RedisHandler.to("my:channel"))
>>> l.info("I like pie")
>>> l.error("Trousers!", exc_info=True)
Redis clients subscribed to my:channel will get a json log record like the following (sent from function foo() in file test.py:
{ username: 'jed',
args: [],
name: 'my.logger',
level: 'info',
line_no: 6,
traceback: null,
filename: 'test.py',
time: '2011-06-02T14:50:08.237052',
msg: 'winning',
funcname: 'foo',
hostname: 'smoothie.local' }
If an exception is raised, and exc_info is True, the log will include a formatted traceback in traceback.
The date is stored as an ISO 8601 string in GMT.
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.
Serving Suggestion
Redis pub/sub messages are not persistent; they are just messages. So you will probably wish to use this handler in conjunction with other handlers that actually save your data, like the standard python FileHandlers, or Andrei Savu’s MongoDB logging handler.
Contributors
Metadata
Release files for python-redis-log 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-redis-log-0.1.2.tar.gz | 4.7 kB | Without provenance | Details for python-redis-log-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_redis_log-0.1.2-py2.6.egg | Legacy Egg format | - | - | Details for python_redis_log-0.1.2-py2.6.egg |
Total release size: 12.5 kB
Release files / python-redis-log-0.1.2.tar.gz
| Download URL | python-redis-log-0.1.2.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b470f31f1481336d596e6d9e850ad3e6cbfebc0425f189b3309a98d2eaf3dfa
|
|
BLAKE2b-256 checksum How to use checksums |
daa30c6108ea0978a9533bac4f645171dcdacf7e89a67baa56c228fb795f0c0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / python_redis_log-0.1.2-py2.6.egg
| Download URL | python_redis_log-0.1.2-py2.6.egg |
|---|---|
| Size | 7.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
c4ceca42c726042b8f69b57bf04a036456937815f2cadaba7b3eced01e5ab81c
|
|
BLAKE2b-256 checksum How to use checksums |
89f27f60d083d21e97551d1be7c049ec4c756e7ad2e6c70eacde148dcbecaa27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-redis-log 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.