pino-debug
pino-debug copied to clipboard
Can't be used in conjunction with pino-elasticsearch
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.
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.
I gave it a shot - https://github.com/pinojs/pino-debug/pull/28 credit to https://github.com/krakenjs/freshy for the code snippet