Closed tripodsan closed 5 years ago
suggestion: create a envInjectionMessageDelegator
that adds the env variables to the json data:
const logger = new CoralogixLogger(apyKey, appName, subsystemName, {
level: 'debug',
formatter: envInjectionMessageDelegator({
ow: {
activationId: '__OW_ACTIVATION_ID',
actionName: '__OW_ACTION_NAME',
},
}, messageFormatJson),
});
rootLogger.loggers.set('coralogix', logger);
this will produce log data like:
{
"level": "info",
"ow": {
"activationId": "c3933fb666f1bc8222f90640fdf9dbf1ecbc0d90f6e06b80914fe8718cd69285",
"actionName": "helix-test/main@1.2.3"
},
"message": "creating 42 tasks for testing",
"timestamp": "2019-09-19T01:45:57.615Z"
}
it would be cool if there is a simple way to inject process.env variables to the formatter, so that certain environment variables are logged automatically.