v0.9.2
Minor Feature Release
Features / Changes
- Add
flagandprefixconstructor options
Flag and Prefix
To support easier alert scanning and detection of log messages, it is often desired to flag error channel messages with a unique string.
The flag option if set to a string, then error and fatal channel messages will define a property of that string name set to the true value.
e.g.
let log = new SenseLogs({flag: 'ERROR_DETECTED'})
log.error('Bad condition')
Will output
{
"@chan": "error",
"message": "Bad condition",
"ERROR_DETECTED": true,
You may also set the flag option to a hash:
let log = new SenseLogs({flag: { error: 'ERROR', fatal: 'ERROR'})
log.error('Bad condition')
May be set to an object map of channel names and property values to set for those channel names. Default to null.
If you are using the console destination, you can set the prefix option to a property name so that log messages will use that prefix after it has been converted to uppercase. The default prefix is "@chan" which causes messages to be prefixed with INFO, ERROR, FATAL etc. This is similar to what node on Lambda does.
Fixes
- none