logging-best-practices
Structured logging with proper levels, context, PII handling, centralized aggregation. Use for application logging, log management integration, distributed tracing, or encountering log bloat, PII exposure, missing context errors.
By secondsky · 353 installs
npx skills add secondsky/claude-skills --skill logging-best-practices
Source repository · Upstream listing
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)
Request Context
PII Sanitization
Best Practices
Use structured JSON format
Include correlation IDs across services
Sanitize all PII before logging
Use async logging for performance
Implement log rotation
Never log at DEBUG in production
Additional Implementations
See [references/advanced logging.md](references/advanced logging.md) for:
Python structlog setup
Go zap high performance logging
ELK Stack integration
AWS CloudWatch configuration
OpenTelemetry tracing
Never Do
Log passwords or tokens
Use console.log in production
Log inside tight loops
Include stack traces for client errors