Skip to main content

ducktrace‑python

A duck‑themed logging system for Python, with colourful console output and automatic file logging.

🦆 Works seamlessly with the ducktrace family:

Features

  • 📄 Logs are written to ~/.config/duckTrace/ (configurable via DT_LOG_PATH)

  • 🎨 Colourful, duck‑themed console output

  • 📁 Respects DT_LOG_LEVEL and DT_LOG_FILE environment variables

  • ⏱️ Includes a dt_timer decorator and PerformanceTimer context manager for performance measurement

  • 🛠️ Simple dt_debug, dt_info, … functions for quick logging


Installation

pip install ducktrace

Or directly from GitHub:

pip install git+https://github.com/QuackHack-McBlindy/ducktrace-python.git

NixOS (using flakes)

Add the flake input to your flake.nix:

{
  inputs.ducktrace-python.url = "github:QuackHack-McBlindy/ducktrace-python";

  outputs = { self, nixpkgs, ducktrace-python, ... }: {
    nixosConfigurations.myMachine = nixpkgs.lib.nixosSystem {
      modules = [
        {
          environment.systemPackages = [
            ducktrace-python.packages.${system}.default
          ];
        }
      ];
    };
  };
}

Build from source

$ git clone https://github.com/QuackHack-McBlindy/ducktrace-python.git
$ cd ducktrace-python
$ pip install .

Or with Nix (inside the repo):

nix build
# result/ will contain the package

Usage

import ducktrace

# Initialise logging (reads DT_LOG_LEVEL, DT_LOG_PATH, DT_LOG_FILE)
ducktrace.dt_setup()

ducktrace.dt_info("Application started")
ducktrace.dt_debug("This is a debug message")
ducktrace.dt_error("Something went wrong")

# Timing decorator
@ducktrace.dt_timer()
def slow_function():
    time.sleep(1)

slow_function()

# Context manager timer
with ducktrace.PerformanceTimer("database query") as timer:
    # … some work …
    timer.lap("after connect")
    # … more work …

Environment Variables

$DT_LOG_LEVEL – DEBUG, INFO, WARNING, ERROR, CRITICAL (default: INFO)

$DT_LOG_PATH – directory for log files (default: ~/.config/duckTrace/)

$DT_LOG_FILE – filename inside that directory (default: PyDuckTrace.log)



License

MIT

Metadata

Release files for ducktrace 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ducktrace 0.1.0
File Size Uploaded Provenance
ducktrace-0.1.0.tar.gz 5.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ducktrace 0.1.0
File Interpreter ABI Platform
ducktrace-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / ducktrace-0.1.0.tar.gz

Download URL ducktrace-0.1.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0e42e3694ea8063d82d201e8f19a3b5be56c2213319aaba7e90d4a154c0fd57c
BLAKE2b-256 checksum
How to use checksums
27485a4355364eeb74714b0a48fca1e96cda52fe6957d710571d8edf2d517bbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.12

Release files / ducktrace-0.1.0-py3-none-any.whl

Download URL ducktrace-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d29650bb6b5519648cf0b3cba0136ec40e12755a7139c3173fc66a73b29b9707
BLAKE2b-256 checksum
How to use checksums
0b216dd7d2e55cdd44e5ba4e129ba0e775da4b360b5bcd629913c140b508fa61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.12

Security for ducktrace 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page