Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

Launch price

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.

See plansStart free instead

Module 10 · System Design · Six more low-level rounds

Design a logger (levels, handlers and the one instance)

Design a Logger
Design a Logger · Open board

Levels and thresholds, the chain every handler sees, what a singleton costs in tests, and the queue in front of a slow disk.

Before you start. You need two lessons and three small words. A class is a blueprint for objects. A method is an action an object can do. A thread is one line of work a program runs, and a program can run several at once. Five letters, one shop (SOLID) gave the rule that a class should have one job and depend on a small front, not on a concrete part. Swap the rule, keep the class (Strategy and Factory) showed a strategy (one job, several interchangeable rules, all answering the same call) and dependency injection: handing a class its parts from outside instead of letting it build them. This lesson uses both to build a small logging library.

Lesson 48 of 73 in System Design

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The 1980s: a program with nobody at the terminal
  • Log level: a number on every call-out
  • Handler: one place a message can go
  • Formatter: how each place wants the line to look
  • Chain of responsibility: each handler decides, then passes on
  • Singleton: the one instance everybody reaches for

Terms it explains: class, method, thread, dependency injection, syslog, log level, threshold, enum, handler, formatter, chain of responsibility, singleton, module-level variable.

Review System Design