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
Built Distribution
Close
Hashes for redis-log-handler-0.0.1.dev9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52c7e71edd22af8c2b23ef34a2df6087a0a036191ecbf9a576dd33916c3d0135 |
|
MD5 | d69cb2ccc038f20dc08146dcff0997b9 |
|
BLAKE2b-256 | 1067e532795a9b2a67655e0fb82211d619d048e6fec08bed201077b2db7ced47 |
Close
Hashes for redis_log_handler-0.0.1.dev9-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d89faf32207867850541fbc566cc918efb4504f10c2e54cfb76c21fd36cfe3a0 |
|
MD5 | 9c03e02d098f8bdf0f9fe062dfbf178e |
|
BLAKE2b-256 | 9c67bf314e796bd9b6f4903b9851063dccf0f142728eb12b5777ab97bbf2a292 |