Untitled Lesson
Skill Matrix
UNLOCK NODES BY LEARNING NEW TAGS.
Why is it highly recommended to format your production server logs as JSON objects rather than plain text strings?
💻 Code Challenge | +75 XP
Write the Node.js/Backend code snippet to implement a Node Logging and Catching pipeline. Include the setup and basic execution steps.
You are reviewing a Node Logging and Catching pipeline and the output is incorrect. Reorder the following pipeline stages in the correct logical order to fix the bug: Input Data, Process, Output.
Task: Reorder the blocks in logical sequence to solve the problem.
A.D.A. Interface
Adaptive Didactic Assistant

Pascual Vila
Frontend Instructor // Code Syllabus
The Error //
Logging sensitive data (passwords, tokens, full credit card numbers) in plaintext
// Wrong
logger.info('Login attempt', req.body); // includes plaintext password
// Correct
const { password, ...safeBody } = req.body;
logger.info('Login attempt', safeBody);The Solution //
Log entries often end up in third-party monitoring tools or long-retention storage that far more people can access than the production database itself. Redact or omit fields like password, authorization, and token before logging any request/response object.
The Error //
Using console.log as the only error visibility in production
// Wrong: console.log('DB connection failed');
// Correct: logger.error({ msg: 'DB connection failed', err });The Solution //
console.log output disappears the moment a container restarts or a process crashes, and it isn't queryable at scale. Use a structured logger (Winston, Pino) that writes JSON to a persistent destination (file, external log aggregator) so failures are still visible after the process is gone.