npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nathapp/nestjs-logging

v2.0.4

Published

nestjs-logging

Readme

nestjs-logging Library

LoggingModule

The LoggingModule provides centralized logging capabilities for your NestJS application. It can be imported into any module to enable structured and configurable logging.

Installation

npm install @nathapp/nestjs-logging

Usage

Importing the Module

import { LoggingModule } from '@nathapp/nestjs-logging';

@Module({
  imports: [LoggingModule.forRoot({
    level: 'info', // log level: 'debug', 'info', 'warn', 'error'
    // other configuration options
  })],
})
export class AppModule {}

then bootstrap on app.useLogger

import { AppModule } from './app.module';
import { Logger } from '@nathapp/nestjs-logging';

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    bufferLogs: true,
    //..the rest setting
  });

  app.useLogger(app.get(Logger));
  // (Optinal) flush the log immediately after setting logger
  app.flushLogs();
  app.listen(process.env.PORT ?? 3000);
}
bootstrap();

or using LoggerFactory

import { AppModule } from './app.module';
import { Logger } from '@nathapp/nestjs-logging';

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    logger: LoggerFactory.createLogger({
      type: 'pino',
      level: 'debug',
      file: {
        enabled: false,
      },
    }),
  });

  await app.start();
}
bootstrap();
import { LoggerService } from '@nathapp/nestjs-logging';
import { Logger } from '@nestjs/common'

@Injectable()
export class MyService {
  const logger = new Logger(MyService.name)
  constructor() {}

  doSomething() {
    this.logger.log('Doing something...');
  }
}

Features

  • Structured logging
  • Customizable log levels and and log type
  • Integration with NestJS dependency injection

LoggingModuleOptions

The LoggingModuleOptions interface allows you to configure the behavior of the LoggingModule. Below are the available options:

| Option | Type | Description | Default | | -------------- | -------------- | ---------------------------------------------------------------------------------------------| ----------- | | level | string | Minimum log level. One of 'debug', 'info', 'warn', 'error'. | 'info' | | type | string | Logger provider type. One of 'default', 'pino', 'winston'. | 'default' | | file | object | File logging options (enable file logging, file path, rotation, etc). | undefined | | console | object | Console logging options (enable pretty print, etc). | undefined | | redact | string[] | Keys or paths to redact from logs (e.g., sensitive data). | [] | | autoLogging | object | Enable automatic HTTP request logging or configure its behavior. | { enabled: true } | | middleware | object | Enable or configure context middleware for incoming requests. | { enableContext: true } |

Example

LoggingModule.forRoot({
  level: 'debug',
  type: 'pino',
  file: {
    enabled: true,
    rotation: '1d',
  },
  console: {
    enabled: true,
    prettyPrint: true,
  },
})

Note:

  • For pino, you must install pino.
  • For winston, you must install winston.
  • For file logging and rotation, you must install rotating-file-stream.
  • For pretty console output with Pino, install pino-pretty.
  • For centralized logging with Pino, install pino-loki.
  • For centralized logging with Winston, install winston-loki.