aj-geddes avatar

Logging Best Practices

This covers the fundamentals you need to get logging right: structured JSON formats, proper log levels (DEBUG through FATAL), contextual data like request IDs, and PII redaction. It includes practical examples for distributed tracing, centralized logging setups, and log sampling for high-volume services. The best practices section is solid, especially the warnings about not logging sensitive data and avoiding console.log in production. Most useful when you're setting up logging infrastructure from scratch or auditing what you already have. The TypeScript examples are clean, though you'll need to adapt them to your language and existing logger library.

skills.sh installs
742
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill logging-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

Logging Best Practices

Table of Contents

Overview

Comprehensive guide to implementing structured, secure, and performant logging across applications. Covers log levels, structured logging formats, contextual information, PII protection, and centralized logging systems.

When to Use

  • Setting up application logging infrastructure
  • Implementing structured logging
  • Configuring log levels for different environments
  • Managing sensitive data in logs
  • Setting up centralized logging
  • Implementing distributed tracing
  • Debugging production issues
  • Compliance with logging regulations

Quick Start

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) {}

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
DevOps & CI/CD, AI & Agent Building, Debugging
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258
1alirezarezvani avatardocker-developmentalirezarezvani/claude-skillsDocker and container development agent skill and plugin for Dockerfile optimization, docker-compose orchestration, multi-stage builds, and container security ha720skills.sh installs
2mindrally avatarmonitoring-guidelinesmindrally/skillsMonitoring guidelines for applications and infrastructure including metrics collection, alerting strategies, and SLO-based monitoring720skills.sh installs
3alirezarezvani avatarterraform-patternsalirezarezvani/claude-skillsTerraform infrastructure-as-code agent skill and plugin for Claude Code, Codex, Gemini CLI, Cursor, OpenClaw. Covers module design patterns, state management st647skills.sh installs
4sundial-org avatartopic-monitorsundial-org/awesome-openclaw-skillsMonitor topics of interest and proactively alert when important developments occur. Use when user wants automated monitoring of specific subjects (e.g., product598skills.sh installs
5aj-geddes avatarsecurity-audit-loggingaj-geddes/useful-ai-promptsImplement comprehensive security audit logging for compliance, forensics, and SIEM integration. Use when building audit trails, compliance logging, or security 568skills.sh installs
6wanshuiyin avatarresearch-refine-pipelinewanshuiyin/auto-claude-code-research-in-sleepRun an end-to-end workflow that chains `research-refine` and `experiment-plan`. Use when the user wants a one-shot pipeline from vague research direction to foc533skills.sh installs