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.2.tar.gz
(1.6 kB
view hashes)
Built Distribution
Close
Hashes for lazy_redis_log-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de5ccc92ca605af172f8cdf2d159611180d9a196796c4f5598bee915eb1d7cfd |
|
MD5 | d53ab7784d6147cc9dc90d0973df1217 |
|
BLAKE2b-256 | ab28b069c5f3b5639467fd329da5513f9d010efe9d203abdc9a001d339ded355 |