ducktrace‑python
A duck‑themed logging system for Python, with colourful console output and automatic file logging.
🦆 Works seamlessly with the ducktrace family:
- ducktrace‑tui (TUI for Viewing logs and service management)
- ducktrace‑logger (Rust apps)
- ducktrace‑sh (Bash scripts)
Features
-
📄 Logs are written to
~/.config/duckTrace/(configurable viaDT_LOG_PATH) -
🎨 Colourful, duck‑themed console output
-
📁 Respects
DT_LOG_LEVELandDT_LOG_FILEenvironment variables -
⏱️ Includes a
dt_timerdecorator andPerformanceTimercontext 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)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ducktrace-0.1.0.tar.gz | 5.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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.