
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-codeInstalls into .claude/skills of the current project.
Files
Logging Best Practices
Implement secure, structured logging with proper levels and context.
Log Levels
| Level | Use For | Production |
|---|---|---|
| DEBUG | Detailed debugging | Off |
| INFO | Normal operations | On |
| WARN | Potential issues | On |
| ERROR | Errors with recovery | On |
| FATAL | Critical failures | On |
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- Cloudflare Manager407
- Plan Interview406
- Ml Pipeline Automation402
- Nuxt Core401
- Nuxt Data400
- Microservices Patterns398
- Multi Ai Consultant397
- Graphql Implementation393
- Mcp Management393
- Model Deployment393
- Jest Generator391
- Cloudflare Agents389
- Cloudflare Mcp Server388
- Thesys Generative Ui384
- Access Control Rbac381
- Maz Ui380
- React Best Practices380
- Woocommerce Backend Dev379
- Woocommerce Code Review379
- Bun Hono Integration376
- Bun Test Basics375
- Woocommerce Copy Guidelines374
- Woocommerce Dev Cycle374
- Cloudflare Workers Security369