Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug does not redirect output to logger when used in a TS project #125

Open
kamatheuska opened this issue Dec 29, 2022 · 0 comments
Open

Comments

@kamatheuska
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant