From aj-geddes-useful-ai-prompts-4
Sets up structured JSON logging with log aggregation and centralized analysis. Use when implementing ELK stack, adding request tracing, or debugging application behavior.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:application-loggingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
Implement comprehensive structured logging with proper levels, context, and centralized aggregation for effective debugging and monitoring.
Minimal working example:
// logger.js
const winston = require("winston");
const logFormat = winston.format.combine(
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
winston.format.errors({ stack: true }),
winston.format.json(),
);
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || "info",
format: logFormat,
defaultMeta: {
service: "api-service",
environment: process.env.NODE_ENV || "development",
},
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple(),
),
}),
new winston.transports.File({
filename: "logs/error.log",
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Node.js Structured Logging with Winston | Node.js Structured Logging with Winston |
| Express HTTP Request Logging | Express HTTP Request Logging |
| Python Structured Logging | Python Structured Logging |
| Flask Integration | Flask Integration |
| ELK Stack Setup | ELK Stack Setup |
| Logstash Configuration | Logstash Configuration |
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4Implements structured logging with JSON formats, log levels, contextual logging, PII handling, and centralized logging. Covers distributed tracing, log sampling, and performance logging.
Provides logging best practices focused on wide events (canonical log lines) for richer debugging and analytics. Applicable when implementing or reviewing logging code.
Implements structured logging with levels, request context, PII sanitization using Winston in Node.js. Covers Python structlog, Go zap, ELK/CloudWatch integration for log bloat, PII exposure, missing context.