Is there any way to retrieve the pino log before it outputs to the console? For example if I have the following
import pino from 'pino';
// Create a logger instance
const logger = pino({
level: 'info', // Set the log level
prettyPrint: true, // Optional: Pretty print the logs
});
// Export the logger instance if you want to use it in other files
export default logger;
and then
logger.info("in function x");
I get the following in my console
{“level”:20″,timestamp”:”2024-08-16T16:53:55.368Z”,”pid”:26068,”hostname”:”xxx”,”traceId”:”ebacaa63-5cb6-47b5-8cb9-8f3600a8c35f”,”message”:”in function x”}
is there any way for me to retrieve this log without writing it to a file (just storing the ouput of logger.info into a local variable?