pinojs / pino-pretty

🌲Basic prettifier for Pino log lines
MIT License
1.22k stars 147 forks source link

How to use transport with nestjs? #485

Closed boris-jenicek closed 8 months ago

boris-jenicek commented 8 months ago

tried: target: require.resolve('./pino-pretty-transport'), got: [Nest] 33251 - 12/30/2023, 3:19:40 PM ERROR [ExceptionHandler] The "path" argument must be of type string. Received type number (40)

tried: target: './pino-pretty-transport', got: [Nest] 33330 - 12/30/2023, 3:21:36 PM ERROR [ExceptionHandler] unable to determine transport target for "./pino-pretty-transport" Error: unable to determine transport target for "./pino-pretty-transport"

pino-pretty-transport.js

const pinoPretty = require('pino-pretty');

module.exports = function pinoPrettyTransport(opts) {
  return pinoPretty({
    ...opts,
    messageFormat(log, messageKey, levelLabel) {
      if (log.req)
        return `${log.req.method} ${log.req.url} - ${log.responseTime}ms`;
      return `${log.msg}`;
    },
  });
};
mcollina commented 8 months ago

Thanks for reporting. We do not have the resources to support Nest.js users. Please refer to the Nest Discord channel (support) for such questions.