HomeChallengesRepsProblemsLeaderboardTake a challenge

What is worth logging

A service that logs by string interpolation, logs a password, swallows the exception it caught and pays to build a debug message nobody will read. Make every line structured, cheap when switched off, and free of anything you would not want in a support ticket.

Intermediate20 min on the clock6 graded checks · 100 pointsA Request You Can Trace
Graded by reading your code against the checklist below.

What you build

  • Message templates with named holes, not interpolated strings
  • The exception passed as the exception argument
  • A scope so every line in the request carries the customer id
  • No secret or password reaches a log line
  • A debug message guarded by IsEnabled
  • A compile-time LoggerMessage for the hot path

Done means

Every line is queryable by field, nothing sensitive is written, and switching debug off costs nothing.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. Log messages use named templates, not interpolation+25Running it in production
  2. The exception is logged as an exception+20Error handling
  3. Request context is attached once and carried+20Running it in production
  4. Nothing sensitive reaches a log line+20Settings, not string literals
  5. A dropped debug message costs nothing+10Running it in production
  6. The hot path uses a source-generated message+5Running it in production

What it teaches

The rest of A Request You Can Trace