Docs / Guides / Logging & health

Feature 07 · Study guide

Logging & health

Wire logs clients can trust, and expose health endpoints for probes.

What you will learn
  • How to write application logs
  • Where log files live
  • What /health and /health/ready mean

1. Setup logging

from tpy.logging import get_logger

log = get_logger("app")
log.info("server started", host="127.0.0.1")
log.error("payment failed", order_id="ord_1")

By default you get console output and a file under storage/logs/. Channels: console, file, stack.

from tpy.logging import LogManager

manager = LogManager()
manager.configure(level="DEBUG", log_dir="storage/logs", app_name="myapp")
manager.channel("file").warning("only file")

2. Health endpoints

PathPurpose
GET /healthProcess is up (liveness)
GET /health/readyReady to take traffic (when Application mounts checks)

Use these in Docker/Kubernetes probes or load balancer checks.

3. How it connects to the kernel

If you boot with Application(...).create() / mount(), logging and health helpers register with the app. Generated app/main.py still exposes a basic health route for soft-break projects.

More depth: Logging & Config.