Structured logging
P37.logging.01 · Audience: guest, it-ml, language-pro
Observability starts with logs — but not the print-a-sentence kind. A production
service logs structured records: dicts of key/value fields a log system can
filter, aggregate and alert on. This module has you build a structured logger, so
the two mechanics that make it work — context binding and redaction — are
yours.
ⓘ Concept: Log fields, not sentences
"handled request for alice, status 200" you emit {"event": "handled", "user": "alice", "status": 200} — now "all 500s for alice" is a query, not a grep.Why it matters — You cannot filter or alert on a sentence; a log system works on fields, so a structured record is what makes logs useful at scale.
Ask the mentor about this module
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
🎓 Practice ladder
2 graded rungs · ~20 minBuild a structured logger with context binding and PII redaction, then design a service's logging in an interview-style prompt.
Rung 1 — build a structured logger (context binding + redaction)
Loading exercise…
Rung 2 — logging in production (interview)
Loading exercise…
Logs tell you about individual events. The next module adds the second and third pillars — metrics for aggregates and traces for where the time went.