인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
생산성 및 협업 · SKILL.md

winston

winston

Winston - versatile logging library for Node.js with multiple transports, custom formatting, and log rotation. Supports structured logging, custom levels, and enterprise integration. USE WHEN: user mentions "winston", "node.js logging", "multiple transports", "log rotation", asks about "how to log to multiple destinations", "rotate log files in Node.js", "…

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: winston description: | Winston - versatile logging library for Node.js with multiple transports, custom formatting, and log rotation. Supports structured logging, custom levels, and enterprise integration.

USE WHEN: user mentions "winston", "node.js logging", "multiple transports", "log rotation", asks about "how to log to multiple destinations", "rotate log files in Node.js", "custom log formats"

DO NOT USE FOR: Pino logging - use pino instead, Python logging - use python-logging instead, Java logging - use slf4j or logback instead allowed-tools: Read, Grep, Glob, Write, Edit

Winston Logger - Quick Reference

When to Use This Skill

  • Logging with multiple transports (file, console, HTTP)
  • Structured logging with custom levels
  • Automatic log file rotation

Deep Knowledge: Use mcp__documentation__fetch_docs with technology: winston for comprehensive documentation.

Basic Setup

npm install winston

Essential Patterns

Logger Base

import winston from 'winston';

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.combine(
    winston.format.timestamp(),
    winston.format.json()
  ),
  transports: [
    new winston.transports.File({ filename: 'error.log', level: 'error' }),
    new winston.transports.File({ filename: 'combined.log' }),
  ],
});

// Add console in development
if (process.env.NODE_ENV !== 'production') {
  logger.add(new winston.transports.Console({
    format: winston.format.simple(),
  }));
}

Custom Format

const customFormat = winston.format.printf(({ level, message, timestamp, ...meta }) => {
  return `${timestamp} [${level.toUpperCase()}]: ${message} ${Object.keys(meta).length ? JSON.stringify(meta) : ''}`;
});

const logger = winston.createLogger({
  format: winston.format.combine(
    winston.format.timestamp(),
    customFormat
  ),
  transports: [new winston.transports.Console()],
});

Child Logger

const childLogger = logger.child({ requestId: req.id, module: 'auth' });
childLogger.info('User authenticated', { userId: user.id });

Daily Rotate File

import DailyRotateFile from 'winston-daily-rotate-file';

const transport = new DailyRotateFile({
  filename: 'logs/app-%DATE%.log',
  datePattern: 'YYYY-MM-DD',
  maxSize: '20m',
  maxFiles: '14d',
});

logger.add(transport);

When NOT to Use This Skill

  • High-performance APIs: Use Pino instead - 10x faster than Winston
  • JSON-only logging: Pino is more optimized for structured JSON output
  • Serverless/Lambda: Prefer simpler console logging or Pino for lower overhead
  • Python/Java projects: Use language-specific logging frameworks
  • Simple scripts: Built-in console is sufficient for basic debugging

Anti-Patterns

Anti-PatternWhy It's BadSolution
Synchronous file loggingBlocks event loop, degrades performanceUse async transports with { stream: ... }
Logging objects without serializationCan log [Object] instead of dataUse JSON.stringify() or Winston JSON format
No log rotationDisk fills up in productionUse winston-daily-rotate-file
Logging in tight loopsOverwhelms I/O, fills disksAdd conditional logic or sample logs
String concatenationAlways evaluated, even when disabledUse format strings: logger.info('User %s', userId)
Missing error stack tracesLoses debugging contextUse { error: err } or Winston error format

Quick Troubleshooting

IssueCauseSolution
Logs not appearingWrong log level configuredCheck logger.level and transport levels
Performance degradationSynchronous file writesUse async transports or reduce log verbosity
Disk fullNo log rotationConfigure winston-daily-rotate-file with maxFiles
[Object] in logsImproper object formattingUse winston.format.json() or winston.format.prettyPrint()
Duplicate logsMultiple transports to same destinationReview transport configuration
Colors not showingConsole transport missing colorizeAdd winston.format.colorize() to console transport
저장한 Skills