@samofprog/nestjs-logstack
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

NestJS LogStack

npm version License: MIT

A configurable Winston logger for NestJS with daily file rotation and console output.

Table of Contents

Features

  • 📊 Seamless integration with NestJS
  • 📅 Daily log rotation with configurable retention
  • 📁 Automatic log file organization by log level (info, warn, error)
  • 🗜️ Compressed archive support for older logs
  • 🎨 Colorized console output for development
  • 🔄 JSON formatted logs for production environments

Installation

# with npm
npm install @samofprog/nestjs-logstack

# or with yarn
yarn add @samofprog/nestjs-logstack

Note: Ensure you also have winston, winston-daily-rotate-file, and @nestjs/common as dependencies.

Example

// main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { createNestLoggerService } from '@samofprog/nestjs-logstack';

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    logger: createNestLoggerService(),
  });
  await app.listen(3000);
}
bootstrap();

You can also customize the max size and number of days logs are kept:

logger: createNestLoggerService("10m", "7d");

Package Sidebar

Install

npm i @samofprog/nestjs-logstack

Weekly Downloads

70

Version

2.0.0

License

MIT

Unpacked Size

13.9 kB

Total Files

8

Last publish

Collaborators

  • samofprog