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

@ciscode/logging-kit

v1.0.2

Published

Universal logging library for NestJS with configurable transports (Console, File, HTTP/Dynatrace)

Readme

@ciscode/logging-kit

Universal logging library for NestJS with configurable transports and automatic request correlation.

Features

  • Multiple Transports: Console, File (with daily rotation), HTTP (Dynatrace, etc.)
  • Request Correlation: Automatic correlation ID tracking via X-Request-Id header
  • Environment-based Config: Configure via environment variables with per-environment overrides
  • NestJS Integration: DynamicModule with injectable LoggingService
  • TypeScript: Full type safety with exported interfaces

Installation

npm install @ciscode/logging-kit

Quick Start

Basic Setup

// app.module.ts
import { Module } from "@nestjs/common";
import { LoggingModule } from "@ciscode/logging-kit";

@Module({
  imports: [
    LoggingModule.register({
      defaultMeta: { service: "my-app" },
    }),
  ],
})
export class AppModule {}

Using the Logger

// my.service.ts
import { Injectable } from "@nestjs/common";
import { LoggingService } from "@ciscode/logging-kit";

@Injectable()
export class MyService {
  constructor(private readonly logger: LoggingService) {}

  doSomething() {
    this.logger.info("Processing request", { userId: 123 });
    this.logger.error("Something went wrong", { error: "details" });
  }
}

With Correlation ID Interceptor

// main.ts
import { NestFactory } from "@nestjs/core";
import { CorrelationIdInterceptor } from "@ciscode/logging-kit";
import { AppModule } from "./app.module";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  // Apply globally for automatic request correlation
  app.useGlobalInterceptors(app.get(CorrelationIdInterceptor));

  await app.listen(3000);
}
bootstrap();

Async Configuration

// app.module.ts
import { Module } from "@nestjs/common";
import { ConfigModule, ConfigService } from "@nestjs/config";
import { LoggingModule } from "@ciscode/logging-kit";

@Module({
  imports: [
    ConfigModule.forRoot(),
    LoggingModule.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (configService: ConfigService) => ({
        config: {
          level: configService.get("LOG_LEVEL", "info"),
          http: configService.get("LOG_HTTP") === "true",
          httpUrl: configService.get("DYNATRACE_URL"),
          httpApiKey: configService.get("DYNATRACE_API_KEY"),
        },
        defaultMeta: { service: configService.get("APP_NAME") },
      }),
    }),
  ],
})
export class AppModule {}

Configuration

Environment Variables

| Variable | Default | Description | | ------------------- | ---------------- | --------------------------------------------------------- | | LOG_LEVEL | info | Log level: error, warn, info, http, verbose, debug, silly | | LOG_CONSOLE | true | Enable console output | | LOG_FILE | false | Enable file logging | | LOG_FILE_PATH | ./logs/app.log | Log file path | | LOG_FILE_MAXSIZE | 10485760 | Max file size in bytes (10MB) | | LOG_FILE_MAXFILES | 5 | Max number of rotated files | | LOG_HTTP | false | Enable HTTP transport | | LOG_HTTP_URL | | HTTP endpoint URL (e.g., Dynatrace) | | `LOG_HTTP_API_KEY` | | API key for HTTP transport |

Per-Environment Overrides

Append _DEVELOPMENT, _PRODUCTION, etc. to any variable:

LOG_LEVEL=info
LOG_LEVEL_DEVELOPMENT=debug
LOG_LEVEL_PRODUCTION=warn

Dynatrace Integration

LOG_HTTP=true
LOG_HTTP_URL=https://your-instance.live.dynatrace.com/api/v2/logs/ingest
LOG_HTTP_API_KEY=your-api-token

API Reference

LoggingModule

  • LoggingModule.register(options?) - Sync registration
  • LoggingModule.registerAsync(options) - Async registration with factory

LoggingService

Implements the Logger interface:

interface Logger {
  error(message: string, meta?: LoggerMetadata): void;
  warn(message: string, meta?: LoggerMetadata): void;
  info(message: string, meta?: LoggerMetadata): void;
  http(message: string, meta?: LoggerMetadata): void;
  verbose(message: string, meta?: LoggerMetadata): void;
  debug(message: string, meta?: LoggerMetadata): void;
  silly(message: string, meta?: LoggerMetadata): void;
  child(meta: LoggerMetadata): Logger;
}

Decorators

  • @InjectLogger() - Inject the Logger instance directly

Interceptors

  • CorrelationIdInterceptor - Attaches correlation ID to requests and logs

Architecture

src/
├── core/               # Framework-free types and utilities
│   ├── types.ts        # Logger interface, config types
│   ├── config.ts       # Environment-based configuration
│   └── correlation.ts  # Correlation ID utilities
├── infra/              # Winston implementation (internal)
│   ├── transports.ts   # Transport factory
│   └── logger.factory.ts  # Logger creation
└── nest/               # NestJS integration
    ├── module.ts       # DynamicModule
    ├── service.ts      # Injectable LoggingService
    ├── interceptor.ts  # CorrelationIdInterceptor
    └── decorators.ts   # @InjectLogger()

Scripts

  • npm run build – Build to dist/
  • npm test – Run tests
  • npm run typecheck – TypeScript type checking
  • npm run lint – ESLint
  • npm run format / npm run format:write – Prettier

License

MIT