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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@origins-digital/logger

v1.2.0

Published

Origins Digital NestJS Logger with Winston

Readme

@origins-digital/logger

A comprehensive logging package for NestJS applications using Winston.

Installation

npm install @origins-digital/logger

Features

  • Winston-based logging with JSON formatting
  • Request logging middleware
  • Configurable log levels
  • Environment-specific formatting (local vs production)
  • Automatic stack trace inclusion
  • Request/response metadata logging
  • Sensitive data filtering

Usage

Basic Setup

import { Module } from '@nestjs/common';
import { LoggerModule } from 'nestjs-winston';
import { LoggerConfig } from '@origins-digital/logger';

@Module({
  imports: [LoggerModule.forRoot(LoggerConfig.instance().loggerOptions())],
})
export class AppModule {}

Using the Logger

import { Controller, Get } from '@nestjs/common';
import { Logger } from '@nestjs/common';
import { LoggerMiddleware } from '@origins-digital/logger';

@Controller('example')
export class ExampleController {
  private readonly logger = new Logger(ExampleController.name);

  @Get()
  getExample() {
    this.logger.log('This is an info message');
    this.logger.debug('This is a debug message');
    this.logger.warn('This is a warning message');
    this.logger.error(
      'This is an error message',
      new Error('Something went wrong'),
    );

    return { message: 'Example response' };
  }
}

Request Logging Middleware

import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
import { LoggerMiddleware } from '@origins-digital/logger';

@Module({})
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(LoggerMiddleware).forRoutes('*');
  }
}

Log Levels

The package supports the following log levels:

  • silly (5)
  • debug (4)
  • verbose (3)
  • info (2) - Default
  • warn (1)
  • error (0)

You can configure the log level using the LOG_LEVEL environment variable, either by name or number.

Log Format

Production Format

{
  "timestamp": "2024-03-21 10:30:45:123",
  "level": "info",
  "message": "Example message",
  "context": "ExampleController",
  "meta": {
    "key": "value"
  }
}

Local Development Format

2024-03-21 10:30:45:123 [ExampleController] info: Example message {"key":"value"}

Request Logging

The middleware automatically logs:

  • Request method and URL
  • Request headers (excluding sensitive data)
  • Request body (excluding sensitive data)
  • Response status and timing
  • Client information (IP, user agent, etc.)
  • Error stack traces (if any)

Configuration

The logger can be configured through environment variables:

  • LOG_LEVEL: Set the logging level (default: 'info')
  • APP_ENV: Set the environment ('local' for colored output, 'production' for JSON)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.