Skip to main content

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)

Uploaded Source

Built Distribution

lazy_redis_log-0.1.3-py3-none-any.whl (2.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page