Like print, but also writes to Redis Streams!
Project description
Lazy Redis Log
Like print(...)
, but also writes to Redis Streams.
Installation
pip install lazy-redis-log
How to Use
from redis import Redis
from lazy_redis_log import LazyRedisLog
LOG = LazyRedisLog()
LOG.redis = Redis(...)
LOG.key = 'logs:example'
LOG.field = 'example'
LOG.do_console = True # Print on the console.
LOG.do_redis = True # Write to Redis.
LOG('Hello World!')
LOG(
'Hello World!',
redis=False, # Don't write to Redis.
)
LOG(
'Hello World!',
console=False, # Don't print on the console.
)
LOG(
'Hello World!',
field='example2'
# Write on this field on the stream.
# This will always write to Redis,
# even if `do_redis` is `False`.
)
LOG(
'Hello',
'World!',
LazyRedisLog,
sep=', ',
end=' END ',
# Functions similarly to `print(...)`.
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lazy_redis_log-0.1.3.tar.gz
(1.7 kB
view hashes)
Built Distribution
Close
Hashes for lazy_redis_log-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77384bb95fa770ab75b0b307116189b841a43dbd9238cf32644428cb3c66d5b7 |
|
MD5 | 349405b035b747a6349480586a7a75d1 |
|
BLAKE2b-256 | 75fd2a5cc34c54cca0bb580c0018dd2c6a40888f7338b21fccb4935811f3f7b6 |