How to use pino-http - 1 common examples

To help you get started, we’ve selected a few pino-http examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ludicrousxyz / light / src / route.ts View on Github external
const loggerPlugin = ({ dev, requestLogger }: Options): any => {
  const pinoOptions = dev ? {
    prettyPrint: true,
    prettifier: pinoPretty,
    level: 'trace',
  } : {};
  const logger = pino((pinoOptions as any));
  const pinoHandler = pinoHTTP({
    logger,
  });
  return (fn: any): any => async (req: IM, res: SR): AP => {
    if (requestLogger) {
      pinoHandler(req, res);
    }
    return fn(req, res);
  };
};

pino-http

High-speed HTTP logger for Node.js

MIT
Latest version published 4 months ago

Package Health Score

86 / 100
Full package analysis

Popular pino-http functions