If you want a one-time root-level enrichment, you can do:
const logger = MikroLog.start();
logger.enrichNext({ someId: '123456789abcdefghi' });
logger.info('Ping!'); // Enrichment is present on log
logger.info('Ping!'); // Enrichment is no longer present
You can also use nested objects:
logger.enrichNext({ myObject: { myValue: 'Something here', otherValue: 'Something else' } });
Static
enrichStatic
resetStatic
startOptional
input: MikroLogInputThis instantiates MikroLog
. In order to be able
to "remember" event and context we use a singleton pattern to
reuse the same logical instance.
If the start
method receives any input, that input will
overwrite any existing metadata, event, and context.
It will also, consequently, wipe the Lambda cold start state.
If you want to "add" to these, you should instead call
enrich()
and pass in your additional data there.
Description
MikroLog is a Lambda-oriented lightweight JSON logger.
Example