npm.io
3.0.1 • Published 5 years ago

@skyhookadventure/lambda-logger

Licence
MIT
Version
3.0.1
Deps
1
Size
198 kB
Vulns
0
Weekly
0

Skyhook Lambda Logger

Built with
typescript version dependants license

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

  1. Don't log private data (e.g. don't log a request object if it has a username in it).
  2. 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.