Skip to main content

Custom log with rotations

Project description

Few Utility Functions

License Python PyPi Build Status

Install

pip install ddcLogs

Logs

  • Setup Logging
    • Logs will rotate based on when variable to a .tar.gz file, defaults to midnight
    • Logs will be deleted based on the days_to_keep variable, defaults to 7
    • Current 'when' events supported:
      • S - Seconds
      • M - Minutes
      • H - Hours
      • D - Days
      • midnight - roll over at midnight
      • W{0-6} - roll over on a certain day; 0 - Monday
from ddcLogs import TimedRotatingLog
log = TimedRotatingLog(
    level = "info",
    directory = "logs",
    filename = "app.log",
    encoding = "UTF-8",
    days_to_keep = 7,
    when = "midnight",
    utc = True
)
log.init()

Source Code

Build

poetry build

Run Tests

poe test

Get Coverage Report

poe coverage

License

Released under the MIT License

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

ddclogs-1.0.1.tar.gz (5.6 kB view hashes)

Uploaded Source

Built Distribution

ddclogs-1.0.1-py3-none-any.whl (7.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