How to Implement Pino Logger in a Next.js (TypeScript) Monorepo for Both Client-Side and Server-Side Logging?

80 views Asked by At

I'm working on a Next.js project using TypeScript, structured within a monorepo, and I'm looking to integrate Pino for logging purposes. my aim to implement logging on both the client-side and server-side but haven't found much documentation on best practices for this specific setup.

Could someone provide guidance or examples on how to properly set up Pino logger in a Next.js (TS) monorepo for comprehensive logging? Any advice on configuring Pino to effectively log client-side activities in addition to server-side operations would be particularly valuable.

this my pino config

`import pino from 'pino';

import GraylogStream from './graylogStream';

const graylogHost = 'host'
const graylogPort = 12201;

const logger = pino(
  {
    level: process.env.LOG_LEVEL || 'info',
    serializers: {
      err: pino.stdSerializers.err,
      req: pino.stdSerializers.req,
      res: pino.stdSerializers.res
    }
  },
  new GraylogStream(graylogHost, graylogPort)
);`
0

There are 0 answers