BeginnerCoder

Lesson 9 — Log levels

Not every message matters

Logs have levels: debug < info < warn < error. In production you usually record only warn and above, so real problems are not buried in noise. Each level gets a number, and a message is printed only if its number is at least the minimum level's number.

const order = { debug: 0, info: 1, warn: 2, error: 3 };

Why it matters: the right level means you can find the one error among a million lines.

Want it another way?
Task

Finish log(): print "LEVEL msg" (level in capitals) only when order[level] >= order[min].

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.