Skip to Content
Node Cookbook - Third Edition
book

Node Cookbook - Third Edition

by Matteo Collina, David Mark Clements, Peter Elger, Mathias Buus Madsen
July 2017
Intermediate to advanced
656 pages
16h 1m
English
Packt Publishing
Content preview from Node Cookbook - Third Edition

Capturing debug logs with with Pino

In Chapter 1, Debugging processes we discussed the debug module, which is used to conditionally output debug logs based on namespaces defined on the DEBUG variable. Both Express and Koa (and the dependencies they use) use the debug module heavily.

The pino-debug module can hook into the debug logs, and wrap them in JSON logs, all while logging at 10 times the speed of the debug module. This affords us the opportunity of high resolution production logging.

Let's check it out copying our express-logging folder from the main recipe, saving it as express-pino-debug-logging and installing pino-debug:

$ cp -fr express-logging express-pino-debug-logging
$ cd express-pino-debug-logging
$ npm install --save pino-debug ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Node Cookbook - Fourth Edition

Node Cookbook - Fourth Edition

Bethany Griggs
Your First Week With Node.js, 2nd Edition

Your First Week With Node.js, 2nd Edition

James Hibbard, Craig Buckler, Mark Brown, Nilson Jacques, James Kolce, Paul Orac, M. David Green, Florian Rappl

Publisher Resources

ISBN: 9781785880087Supplemental Content