pino-debug icon indicating copy to clipboard operation
pino-debug copied to clipboard

Can't be used in conjunction with pino-elasticsearch

Open audishos opened this issue 4 years ago • 2 comments

Since the pino-elasticsearch library implements @elastic/elasticsearch which calls debug, you must initialize pino-debug before creating your logger instance which prevents you from being able to pass that logger instance into pino-debug. This means that while you are able to initialize pino-debug before creating your logger instance, it will use a separate logger instance and therefore, these logs cannot be sent to elasticsearch.

I wonder if it's possible to allow debug calls before initializing pino-debug with the understanding that these calls will not be sent to the logger.

audishos avatar Jun 09 '20 14:06 audishos

This is unfortunate but true :(. I don't know if a PR to adjust this would be possible. In case, we'll be happy to land it.

mcollina avatar Jun 09 '20 17:06 mcollina

I gave it a shot - https://github.com/pinojs/pino-debug/pull/28 credit to https://github.com/krakenjs/freshy for the code snippet

audishos avatar Jun 10 '20 17:06 audishos