Skip to main content

@idearium/log-structured

The Idearium logger HTTP structured logging formatter.

Installation

$ yarn add @idearium/log-structured

Usage

The Idearium logger HTTP structured logging formatter transport takes log output from @idearium/log-http and structures it according to GCP Structured Logging.

It will transform log with req and res properties, completely ignoring anything.

Start your Node application and pipe the output to the structured script (found at node_modules/.bin/structured once this package is installed):

$ node server.js | structured

Pretty printing

If you want to pretty print the results of this formatter, pipe the output to 'pino-pretty';

$ node server.js | structure | pino-pretty

Combining formatters and transports

Sometimes you will want to use multiple transports/formatters. To do this you can use the tee command in bash:

$ node server.js | structured | tee insightops pino-stackdriver --project bar --credentials /credentials.json