pino-debug
pino-debug copied to clipboard
Debug does not redirect output to logger when used in a TS project
I am currently on a TS project in a project type CommonJS with fastify. The compiled version looks like this:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const pinoDebug = require("pino-debug");
const pino_1 = require("pino");
const myLogger = (0, pino_1.default)({
level: 'debug',
});
pinoDebug(myLogger, {
map: {
'app:info:*': 'info',
'app:*': 'debug',
'*': 'trace',
},
});
Still, I am getting pretty-printed logs (unredirected output) when using debug
, while myLogger is the one in JSON format:
app:info:plugins:env Start connection to MongoDB +0ms
{"level":50,"time":1672309093991,"pid":78147,"hostname":"kameush-home","err":{"type":"FastifyError","message":"fastify-plugin: Plugin did not start in time: 'app'. You may have forgotten to call 'done' function or to resolve a Promise: Plugin did not start in time: 'app'. You may have forgotten to call 'done' function or to resolve a Promise","stack":"FastifyError: fastify-plugin: Plugin did not start in time: 'app'. You may have forgotten to call 'done' function or to resolve a Promise\n at manageErr (/home/nicolas/Projects/inventory-app/app/node_modules/fastify/fastify.js:542:33)\n
Is there a workaround to use this module with Typescript?
Example in the example
folder seems to run just fine.