From aj-geddes-useful-ai-prompts-4
Implements structured logging with JSON formats, log levels, contextual logging, PII handling, and centralized logging. Covers distributed tracing, log sampling, and performance logging.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:logging-best-practicesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
references/centralized-logging.mdreferences/contextual-logging.mdreferences/distributed-tracing.mdreferences/log-levels.mdreferences/log-sampling-high-volume-services.mdreferences/performance-logging.mdreferences/pii-and-sensitive-data-handling.mdreferences/structured-logging-json.mdscripts/health-check.shtemplates/dashboard-config.yamlComprehensive guide to implementing structured, secure, and performant logging across applications. Covers log levels, structured logging formats, contextual information, PII protection, and centralized logging systems.
Minimal working example:
// logger.ts
enum LogLevel {
DEBUG = 0, // Detailed information for debugging
INFO = 1, // General informational messages
WARN = 2, // Warning messages, potentially harmful
ERROR = 3, // Error messages, application can continue
FATAL = 4, // Critical errors, application must stop
}
class Logger {
constructor(private minLevel: LogLevel = LogLevel.INFO) {}
debug(message: string, context?: object) {
if (this.minLevel <= LogLevel.DEBUG) {
this.log(LogLevel.DEBUG, message, context);
}
}
info(message: string, context?: object) {
if (this.minLevel <= LogLevel.INFO) {
this.log(LogLevel.INFO, message, context);
}
}
warn(message: string, context?: object) {
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Log Levels | Log Levels |
| Structured Logging (JSON) | Structured Logging (JSON) |
| Contextual Logging | Contextual Logging |
| PII and Sensitive Data Handling | PII and Sensitive Data Handling |
| Performance Logging | Performance Logging |
| Centralized Logging | Centralized Logging |
| Distributed Tracing | Distributed Tracing |
| Log Sampling (High-Volume Services) | Log Sampling (High-Volume Services) |
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4Implements 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.
Guides structured logging with key-value pairs, required fields, and context propagation for debugging in production systems.
Implements structured logging with proper log levels (TRACE through FATAL), level-selection decision trees, and 9 mandatory canonical events for production observability.