v1.0.0 · PyPI

Tiny logging with
PII scrubbing built in.

oak is a dependency-free Python logging framework that wraps the standard library — colored CLI output, JSON mode, structured errors, and automatic redaction of emails, phones, tokens and more.

Get started View on PyPI

Features

Everything you need, nothing you don't.

Log levels

debug, info, warning, error and exception — plus a level filter out of the box.

PII scrubbing

Emails, phone numbers, SSNs, cards, IPs and sensitive keys are redacted automatically.

Structured errors

Exceptions print a readable error-type, message and traceback block.

JSON output

Machine-friendly lines for shipping to log aggregators.

Colored CLI

ANSI colors on TTYs, off for files and pipes. Zero dependencies.

Zero deps

Pure stdlib logging. Python 3.9+.

Quick start

One init() call and you're logging.

shell
$ pip install oak-logging
python
# import stays the same
import oak
python
import oak

log = oak.init("DEBUG")

log.debug("entering parse loop")
log.info("user signed up", extra={"user_id": 42})
log.warning("disk at 90%")
log.error("payment failed for jane@example.com")
python
import oak

log = oak.init("INFO", json=True)
log.info("order placed")
output
{"ts": "2026-08-01T16:20:00+0530", "level": "INFO", "logger": "app", "message": "order placed"}

Live preview

A real session — or write your own line below.

python — oak demo
>>>

The preview scrubs PII the same way the library does — try jane@example.com or 555-123-4567.

PII scrubbing

Redacts what matters, keeps what doesn't.

python
import oak

log = oak.init("DEBUG")
log.info("contact jane@example.com or 555-123-4567")
# contact [REDACTED] or [REDACTED]

log.info("signup", extra={
    "email": "jane@example.com",   # redacted
    "password": "hunter2",         # redacted
    "user_id": 7,                  # kept
})