v0.10.0
Major Feature Release
This release is our 1.0 candidate.
Features / Changes
- Add
formatoption for the SenseLogs constructor - Added an
assertmethod and channel - Added a channel argument to the metrics() method.
Breaking Changes
- Removed the prefix constructor option. Replaced by more flexible destination and format options.
- The console destination will by default use the 'json' format. Use format: 'human' to get the previous output format.
- Added a channel argument to the metrics method to allow metrics to by dynamically controlled via the LOG_FILTER env var.
Output Format Option
The SenseLogs constructor options have been modified. There is a new format option that manages the output format and the destination option is not overloaded to imply a format.
const log = new SenseLogs({format: 'tsv'})By default SenseLogs will emit log messages in JSON format. However, you can configure the logger to emit human readable output by setting the format to human. Tab-delimited format can be specified by setting the format to tsv.
A custom formatting function can be specified via the format option which will be invoked and passed the combined log message context. The function should return the message to output without a trailing new line.
format(context): stringAdd Destinations
Previously, destinations implied a format. There was a JsonDest and a ConsoleDest which always used a human readable output format.
With this update, destination are separated from output formats. There are 3 supplied destinations. The stdoutDest and consoleDest. The stdoutDest is the high performance raw destination. The consoleDest uses console.log and console.error and is somewhat slower. On Node, console.log redundantly prefixes output with the Lambda requestID and timestamp.
Fixes
- none