secondsky avatar

Logging Best Practices

This gives you production-ready logging patterns with Winston for JavaScript, including structured JSON formatting, request correlation IDs via AsyncLocalStorage, and PII sanitization helpers. You get a clear log level guide, async context propagation across requests, and practical examples for redacting sensitive fields like emails and credit cards. Also points you to Python structlog and Go zap implementations if you're working across languages. The "never do" section alone is worth it: no console.log in production, no passwords in logs, no debug-level spam. If you've ever dealt with log bloat or accidentally shipped customer data to your logging service, this covers the basics to prevent it.

skills.sh installs
408
GitHub stars
248
last updated
Aug 21, 2026

Install

$ npx -y skills add secondsky/claude-skills --skill logging-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

Logging Best Practices

Implement secure, structured logging with proper levels and context.

Log Levels

LevelUse ForProduction
DEBUGDetailed debuggingOff
INFONormal operationsOn
WARNPotential issuesOn
ERRORErrors with recoveryOn
FATALCritical failuresOn

Structured Logging (Winston)

const winston = require('winston');

const logger = winston.createLogger({
  level: process.env.LOG_LEVEL || 'info',
  format: winston.format.combine(
    winston.format.timestamp(),
    winston.format.json()
  ),
  defaultMeta: { service: 'api-service' },
  transports: [
    new winston.transports.Console(),
    new winston.transports.File({ filename: 'error.log', level: 'error' })
  ]
});

// Usage
logger.info('User logged in', { userId: '123', ip: '192.168.1.1' });
logger.error('Payment failed', { error: err.message, orderId: '456' });

Request Context

const { AsyncLocalStorage } = require('async_hooks');
const storage = new AsyncLocalStorage();

Sponsors

Details

Repository
github.com/secondsky/claude-skills
Category
DevOps & CI/CD
First seen
Jun 3, 2026

More from secondsky/claude-skills

All 146
1terrylica avatarpython-logging-best-practicesterrylica/cc-skillsPython logging with loguru, structlog, and orjson. TRIGGERS - loguru, structlog, structured logging406skills.sh installs
2bobmatnyc avatarkubernetesbobmatnyc/claude-mpm-skillsKubernetes operations playbook for deploying services: core objects, probes, resource sizing, safe rollouts, and fast kubectl debugging397skills.sh installs
3evoscientist avatarexperiment-pipelineevoscientist/evoskillsGuides structured 4-stage experiment execution with attempt budgets and gate conditions: Stage 1 initial implementation (reproduce baseline), Stage 2 hyperparam396skills.sh installs
4levnikolaevich avatarln-781-build-verifierlevnikolaevich/claude-code-skillsBuilds all detected projects and verifies successful compilation. Use when checking that a bootstrapped project compiles.381skills.sh installs
5levnikolaevich avatarln-771-logging-configuratorlevnikolaevich/claude-code-skillsConfigures structured JSON logging with Serilog (.NET) or structlog (Python). Use when adding logging to backend projects.376skills.sh installs
6sanjay3290 avatarazure-devopssanjay3290/ai-skillsManage Azure DevOps projects, work items, repos, PRs, pipelines, wikis, test plans, security alerts, variable groups, environments/approvals, branch policies, a369skills.sh installs