1.2.0 • Published 9 months ago

winston-context-logger-apm-storage v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Actions Status Actions Status Actions Status Test Coverage Maintainability Packages npm version

Context provider for winston-context-logger implemented by using a elastic-apm-nodejs transaction. With this context provider, it is possible to have a fully contextualized logger where all the context is tied to apm transactions, and the correlationid generated will be the traceparent, contributing even to a trace distribution over a micro service scenario done completely by the apm api.

How to Install

npm i winston-context-logger-apm-storage

How to use it

Just pass it to ContextLogger during instantiation and you're done.

new ContextLogger(logger, apmContextProvider);

You can also create sub custom contexts that will inherit all the metadata from the parents:

await apmContextProvider.subContext('my sub routine', async () => {
  // Do something here
  logger.addMeta('newOne', 'new metadata');
  logger.info('Log with all the inherited metadata and the newOne');
});
  logger.info('Log without the newOne metadata');

License

Licensed under MIT.

1.2.0

9 months ago

1.1.0

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago