A log handler for the Python logging module, emitting all logs to specific Redis channels
Project description
# redis-log-handler
Handler for the std logging module which puts logs through to Redis.
## How to use
Each handler needs a channel name, and where needed a specified port, password or host.
Handlers open a connection to a channel, so they need to be closed after use or the channel will continue to exist.
Logging can be configured globally:
```python
log_handler = RedisLogHandler('ch:channel')
logging.basicConfig(handlers=(log_handler,), level=logging.INFO)
logging.info('Test-message on channel.')
log_handler.close()
```
Or as a specific standalone logger:
```python
log_handler = RedisLogHandler('ch:channel')
logger = logging.getLogger('name')
logger.addHandler(log_handler)
logger.setLevel('WARNING')
logger.warning('Warning message')
log_handler.close()
```
Handler for the std logging module which puts logs through to Redis.
## How to use
Each handler needs a channel name, and where needed a specified port, password or host.
Handlers open a connection to a channel, so they need to be closed after use or the channel will continue to exist.
Logging can be configured globally:
```python
log_handler = RedisLogHandler('ch:channel')
logging.basicConfig(handlers=(log_handler,), level=logging.INFO)
logging.info('Test-message on channel.')
log_handler.close()
```
Or as a specific standalone logger:
```python
log_handler = RedisLogHandler('ch:channel')
logger = logging.getLogger('name')
logger.addHandler(log_handler)
logger.setLevel('WARNING')
logger.warning('Warning message')
log_handler.close()
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for redis-log-handler-0.0.1.dev7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea77676c4d301694f606945bb6578144648b74d1847a62965d50c4a534e41e78 |
|
MD5 | 8c3b8a3580421544f49d7a53fe42dcef |
|
BLAKE2b-256 | 48caef44c3b8903e09b55fe16374013723974ca3114d931a45b8c53cd9174b80 |