NestJS logger service using pino with pretty output in dev.
// Source: https://github.com/ozhehkovski/geoleadscraper | License: MIT | Copyright 2026 GeoLeadScraper contributors
// Provided via justclaw.it.com; keep this notice with the code.
import { LoggerService } from '@nestjs/common';
import { pino, Logger as PinoLogger } from 'pino';
export class Logger implements LoggerService {
logger: PinoLogger;
constructor() {
const isProduction = process.env.NODE_ENV === 'production' || false;
this.logger = isProduction
? pino()
: pino({
transport: {
target: 'pino-pretty',
options: {
colorize: true,
},
},
});
}
log(message: any, ...params: any[]) {
this.logger.info(message, ...params);
}
error(message: any, ...params: any[]) {
this.
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key