import pino from 'pino' import { getTransformStream } from '@probot/pino' const transform = getTransformStream() transform.pipe(pino.destination(1)) // This allows pino to accept a second parameter in logging functions function logMethod(args: string | any[], method: { apply: (arg0: any, arg1: any) => void }) { if (args.length === 2) { //@ts-ignore args[0] = `${args[0]} %j` } // @ts-ignore method.apply(this, args) } export const logger = pino( { name: 'walter-backend', level: process.env.LOG_LEVEL || 'info', hooks: { logMethod }, }, transform ) logger.info(`Using sentry DSN: ${process.env.SENTRY_DSN}`) export const condoManagerLogger = logger.child({ type: 'condo-manager' }) export const notificationLogger = logger.child({ type: 'notification' })