refactor: Enable pino-pretty transport exclusively for development environments.
All checks were successful
Build & Deploy KLZ Cables / 🔍 Prepare Environment (push) Successful in 7s
Build & Deploy KLZ Cables / 🏗️ Build App (push) Successful in 4m6s
Build & Deploy KLZ Cables / 🏗️ Build Gatekeeper (push) Successful in 22s
Build & Deploy KLZ Cables / 🧪 Quality Assurance (push) Successful in 11m52s
Build & Deploy KLZ Cables / 🚀 Deploy (push) Successful in 42s
Build & Deploy KLZ Cables / ⚡ PageSpeed (push) Successful in 4m40s
Build & Deploy KLZ Cables / 🔔 Notifications (push) Successful in 1s
All checks were successful
Build & Deploy KLZ Cables / 🔍 Prepare Environment (push) Successful in 7s
Build & Deploy KLZ Cables / 🏗️ Build App (push) Successful in 4m6s
Build & Deploy KLZ Cables / 🏗️ Build Gatekeeper (push) Successful in 22s
Build & Deploy KLZ Cables / 🧪 Quality Assurance (push) Successful in 11m52s
Build & Deploy KLZ Cables / 🚀 Deploy (push) Successful in 42s
Build & Deploy KLZ Cables / ⚡ PageSpeed (push) Successful in 4m40s
Build & Deploy KLZ Cables / 🔔 Notifications (push) Successful in 1s
This commit is contained in:
@@ -12,20 +12,19 @@ export class PinoLoggerService implements LoggerService {
|
|||||||
// In Next.js, especially in the Edge runtime or during instrumentation,
|
// In Next.js, especially in the Edge runtime or during instrumentation,
|
||||||
// pino transports (which use worker threads) can cause issues.
|
// pino transports (which use worker threads) can cause issues.
|
||||||
// We disable transport in production and during instrumentation.
|
// We disable transport in production and during instrumentation.
|
||||||
const useTransport = !config.isProduction && typeof window === 'undefined';
|
const useTransport = config.isDevelopment && typeof window === 'undefined';
|
||||||
|
|
||||||
this.logger = pino({
|
this.logger = pino({
|
||||||
name: name || 'app',
|
name: name || 'app',
|
||||||
level: config.logging.level,
|
level: config.logging.level,
|
||||||
transport:
|
transport: useTransport
|
||||||
useTransport
|
? {
|
||||||
? {
|
target: 'pino-pretty',
|
||||||
target: 'pino-pretty',
|
options: {
|
||||||
options: {
|
colorize: true,
|
||||||
colorize: true,
|
},
|
||||||
},
|
}
|
||||||
}
|
: undefined,
|
||||||
: undefined,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user