cc-logger
v1.0.0
Published
Logging lib customised for CloudCycle
Downloads
2
Readme
cc-logger
Typescript logging lib customised to CloudCycle
Installation
npm install cc-logger
Usage
import { Logger } from 'cc-logger';
const logger = Logger.getInstance();
// Optionally set some context, typically at the start of a request/top of a lambda handler
logger.setDocketId(event.docketId);
logger.setSourceEventId(event['detail-type']);
// Use info logs sparingly, we want to keep the log level low to save cost and avoid clutter.
// In particular, avoid logging the same message multiple times and logging large payloads.
// Prefer debug logs for most messages.
logger.info('Hello, world!');
logger.error('This is an error message');
logger.warn('This is a warning message');
// Most log messages should be this level
logger.debug('This is a debug message');
Configuration
export LOG_LEVEL=debug