Skip to content
Back to skills

Generic Winston Logger Service

ASecurity

Create a robust, scalable Winston logger service for Node.js projects with daily log rotation, environment-aware formatting, and proper object serialization to prevent [object Object] errors.

  • 17 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 30, 2026
ai-agentsnodenodejsexpress

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill generic-winston-logger-service --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Generic Winston Logger Service?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Generic Winston Logger Service
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-generic-winston-logger-service/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-generic-winston-logger-service)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "00a946f0-d1d2-4d6a-a069-5910fcc30478"
name: "Generic Winston Logger Service"
description: "Create a robust, scalable Winston logger service for Node.js projects with daily log rotation, environment-aware formatting, and proper object serialization to prevent [object Object] errors."
version: "0.1.0"
tags:
  - "winston"
  - "logging"
  - "nodejs"
  - "express"
  - "logger"
triggers:
  - "create a generic logger"
  - "winston logger service"
  - "robust logging setup"
  - "fix [object Object] in logs"
  - "scalable logger configuration"
---

# Generic Winston Logger Service

Create a robust, scalable Winston logger service for Node.js projects with daily log rotation, environment-aware formatting, and proper object serialization to prevent [object Object] errors.

## Prompt

# Role & Objective
Create a generic, robust, and scalable Winston logger service for Node.js applications. The logger must be reusable across projects and handle common logging issues like object serialization.

# Operational Rules & Constraints
1. **Dependencies**: Use `winston` and `winston-daily-rotate-file`.
2. **Transports**: Configure both Console and DailyRotateFile transports.
3. **Log Format**:
   - Use `winston.format.metadata()` to capture metadata.
   - Use ISO 8601 timestamps: `YYYY-MM-DDTHH:mm:ssZ`.
   - Implement a custom `printf` function that formats the log string.
4. **Object Serialization**: Ensure that metadata objects and arrays are serialized using `JSON.stringify(metadata, null, 2)` to prevent `[object Object]` output.
5. **Environment Awareness**:
   - Check `process.env.NODE_ENV === 'development'`.
   - Apply `winston.format.colorize()` to the console transport only in development.
6. **Log Rotation**:
   - Rotate logs daily (`datePattern: "YYYY-MM-DD"`).
   - Enable `zippedArchive: true`.
   - Set `maxSize: "20m"` and `maxFiles: "14d"`.
7. **Exception Handling**:
   - Enable `handleExceptions: true` and `exitOnError: false` on transports.
   - Listen for `unhandledRejection` events and log them using the logger.
8. **Parameters**: The function should accept `appName`, `logPath` (defaulting to current working directory), and `logLevel` (defaulting to "info").

# Anti-Patterns
- Do not use deprecated timestamp formats.
- Do not allow `[object Object]` in log output.
- Do not colorize logs in production environments.

## Triggers

- create a generic logger
- winston logger service
- robust logging setup
- fix [object Object] in logs
- scalable logger configuration

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.