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.
Everything you need, nothing you don't.
debug, info, warning, error and exception — plus a level filter out of the box.
Emails, phone numbers, SSNs, cards, IPs and sensitive keys are redacted automatically.
Exceptions print a readable error-type, message and traceback block.
Machine-friendly lines for shipping to log aggregators.
ANSI colors on TTYs, off for files and pipes. Zero dependencies.
Pure stdlib logging. Python 3.9+.
One init() call and you're logging.
$ pip install oak-logging
# import stays the same
import oak
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")
import oak
log = oak.init("INFO", json=True)
log.info("order placed")
{"ts": "2026-08-01T16:20:00+0530", "level": "INFO", "logger": "app", "message": "order placed"}
A real session — or write your own line below.
The preview scrubs PII the same way the library does — try jane@example.com or 555-123-4567.
Redacts what matters, keeps what doesn't.
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
})