Skip to main content

A python log throttling utility

Project description

log-throttling

A light-weight python log throttling utility

import time
import logging
import log_throttling

logger = logging.getLogger(__name__)

start = time.monotonic()
while time.monotonic() - start < 10:
    log_throttling.by_time(logger, interval=1).info(
        "This line will be logged once every second."
    )
    time.sleep(0.01)

for i in range(100):
    log_throttling.by_count(logger, once_every=10).info(
        "This line will only log values that are multiples of 10: %s", i
    )

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

log-throttling-0.0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

log_throttling-0.0.1-py3-none-any.whl (4.1 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