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

successive-nestjs-logger

v1.3.0

Published

HTTP Json based logger for nestjs

Downloads

7

Readme

successive-nestjs-logger

It is HTTP JSON Logger based on pino-http for Nest Js. It prints log on each request initiation , on each error and on each request completion with X-Sub-Correlation-Id and X-Correlation-Id. It also exposes a service to print custom logs at different levels (log, error, warn. debug and verbose).

Installation

npm i successive-nestjs-logger --save

Examples

  • Include logger module in root/app module to print log on each request initiation , on each error and on each request completion with X-Sub-Correlation-Id and X-Correlation-Id. It accepts a debug_logs parameter to enable/disable debug logs.

    import { Module } from '@nestjs/common';
    import { AppController } from './app.controller';
    import { AppService } from './app.service';
    import { LoggerModule } from 'successive-nestjs-logger';
    
    @Module({
      imports: [LoggerModule.forRoot({
        debug_logs: true
      })],
      controllers: [AppController],
      providers: [AppService],
    })
    
    export class AppModule  {}
    
      
    {"level":30,"time":1627877768457,"pid":27844,"hostname":"my-host","req":{"id":"c9108341-6faa-4913-93ec-527ed2a61ecc","method":"GET","url":"/users","query":{},"params":{},"headers":{"content-type":"application/json","user-agent":"PostmanRuntime/7.28.1","accept":"*/*","postman-token":"573f1a94-b633-4dee-995d-2f33d05992c5","host":"localhost:3000","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"19","X-Sub-Correlation-Id":"95ccd6a9-78c7-4c99-9522-b2608c6de1bb","X-Correlation-Id":"278718dc-ba33-411f-aba2-97905e699ffc"},"remoteAddress":"::1","remotePort":47440,"body":{},"msg":"request started"}
      
    {"level":30,"time":1627877768468,"pid":27844,"hostname":"my-host","req":{"id":"c9108341-6faa-4913-93ec-527ed2a61ecc","method":"GET","url":"/users","query":{},"params":{},"headers":{"content-type":"application/json","user-agent":"PostmanRuntime/7.28.1","accept":"*/*","postman-token":"573f1a94-b633-4dee-995d-2f33d05992c5","host":"localhost:3000","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"19","X-Sub-Correlation-Id":"95ccd6a9-78c7-4c99-9522-b2608c6de1bb","X-Correlation-Id":"278718dc-ba33-411f-aba2-97905e699ffc"},"remoteAddress":"::1","remotePort":47440,"body":{},"res":{"statusCode":200,"headers":{"x-powered-by":"Express","x-correlation-id":"278718dc-ba33-411f-aba2-97905e699ffc","content-type":"text/html; charset=utf-8","content-length":"23","etag":"W/\"17-dz3lQFWsvaILP0XWy2YesfdbyNA\""}},"responseTime":11,"msg":"request completed"}
  • Include Logger service to print custom logs at different levels.

    import { LoggerService } from 'successive-nestjs-logger'
    
    @Controller('employee')
    export class EmployeeController {
      constructor(private readonly employeeService: EmployeeService,
        private readonly loggerService: LoggerService) {}
    
      @Get()
      async getEmployees(): Promise<Employee[]> {
        try{
          this.loggerService.debug("This is debug log");
          this.loggerService.info("This is information log");
          this.loggerService.warn("This is warning log");
          return await this.employeeService.findAll();
        }catch(err){
          throw new InternalServerErrorException(err);
        } 
      }
     } 
    {"level":20,"time":1627881419365,"pid":45993,"hostname":"my-host","req":{"id":"1515e5d9-2c1d-4eaa-ad0a-69a1b73d870b","method":"GET","url":"/users","query":{},"params":{},"headers":{"content-type":"application/json","user-agent":"PostmanRuntime/7.28.1","accept":"*/*","postman-token":"4a1709bf-aac1-49a4-9fd9-be99fef456f6","host":"localhost:3000","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"19","X-Sub-Correlation-Id":"4650d5ee-2422-4908-8391-839802b5ba84","X-Correlation-Id":"6de4f4de-1b8e-44c1-973d-b176ed2cf836"},"remoteAddress":"::1","remotePort":48314,"body":{}},"msg":"This is a debug log"}
      
    {"level":30,"time":1627881419365,"pid":45993,"hostname":"my-host","req":{"id":"1515e5d9-2c1d-4eaa-ad0a-69a1b73d870b","method":"GET","url":"/users","query":{},"params":{},"headers":{"content-type":"application/json","user-agent":"PostmanRuntime/7.28.1","accept":"*/*","postman-token":"4a1709bf-aac1-49a4-9fd9-be99fef456f6","host":"localhost:3000","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"19","X-Sub-Correlation-Id":"4650d5ee-2422-4908-8391-839802b5ba84","X-Correlation-Id":"6de4f4de-1b8e-44c1-973d-b176ed2cf836"},"remoteAddress":"::1","remotePort":48314,"body":{}},"msg":"This is a info log"}
      
    {"level":40,"time":1627881419365,"pid":45993,"hostname":"my-host","req":{"id":"1515e5d9-2c1d-4eaa-ad0a-69a1b73d870b","method":"GET","url":"/users","query":{},"params":{},"headers":{"content-type":"application/json","user-agent":"PostmanRuntime/7.28.1","accept":"*/*","postman-token":"4a1709bf-aac1-49a4-9fd9-be99fef456f6","host":"localhost:3000","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"19","X-Sub-Correlation-Id":"4650d5ee-2422-4908-8391-839802b5ba84","X-Correlation-Id":"6de4f4de-1b8e-44c1-973d-b176ed2cf836"},"remoteAddress":"::1","remotePort":48314,"body":{}},"msg":"This is a warning log"}