Skip to main content.

Pretty PrintingFormat JSON logs for easier reading during development.

When running your process locally for testing and during development, the JSON logs provided by LambdaLog will be shown in the terminal as a single line making it harder to read the logs. You may enable the dev option to have the logs formatted when printed to the console.

Ensure the dev option is DISABLED when deployed. CloudWatch will not be able to parse the logs correctly, causing multiple items to show for a single log message. This will cost more money and yield unfilterable logs within CloudWatch.

Enable dev Option

1const log = require('lambda-log');
2 = true;
1const { LambdaLog } = require('lambda-log');
3const log = new LambdaLog({
4 dev: true


With dev option disabled:'Example log without dev mode', { hello: 'world' });
2/* => { "_logLevel": "info", "msg": "Example log without dev mode", "hello": "world", "_tags": [] } */

With dev option enabled:'Example log with dev mode', { hello: 'world' });
2/* =>
3 {
4 "_logLevel": "info",
5 "msg": "Example log with dev mode",
6 "hello": "world",
7 "_tags": []
8 }