Skip to content
aj-geddes avatar

Logging Best Practices

Structured logging guide covering log levels, JSON formats, PII redaction, and centralized logging practices.

CCM score
41 of 100
skills.sh installs
748
GitHub stars
396
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers log levels (DEBUG through ERROR), JSON structured formats, contextual fields, and performance logging
  • Includes PII and sensitive-data redaction, centralized logging, distributed tracing, and sampling for high-volume services
  • Enforces rules such as no passwords or tokens in logs, no console.log in production, and correlation IDs on every entry
  • Designed for backend teams setting up observability, configuring environment log levels, or debugging production issues

Install

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

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Backend & APIs, Technical Documentation, Debugging
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258

Similar to Logging Best Practices

More Backend & APIs