@skyhookadventure/lambda-logger
v3.0.1
Published
[![Built with typescript](https://badgen.net/badge/icon/typescript?icon=typescript&label)](https://www.typescriptlang.org/) [![version](https://badgen.net/npm/v/skyhook-lambda-logger)](https://www.npmjs.com/package/skyhook-lambda-logger) ![dependants](htt
Downloads
8
Readme
Skyhook Lambda Logger
Exports a pre-configured loglevel logger.
Use
import log from '@skyhookadventure/lambda-logger';
// In descending order
log.error({ success: false });
log.warn({ success: 'maybe' });
log.info({ success: true });
log.debug({ success: true }); // Doesn't show by default
// Enable debug
process.env.LOG_LEVEL = 'debug';
Guidelines
- Don't log private data (e.g. don't log a request object if it has a username in it).
- Focus on logging small objects that can be searched rather than strings
Setting the output log level
By default the log level used is INFO (i.e. HTTP errors won't be shown). In (Jest) testing environments the level is set to ERROR instead.
You can override this by setting process.env.LOG_LEVEL
.
Checklist
| CD Feature | Provided | | ---------- | --------------------------------------- | | ✅ | Typescript | | ✅ | Linting (AirBnB + Prettier) | | ✅ | Unit tests (Jest) | | ✅ | Coverage check (ideally 100% with Jest) | | ✅ | Github Continuous Deployment |
Built by Skyhook
This module is contributed by the team at Skyhook.