
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-codeInstalls 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- Visual Regression Testing731
- Flutter Development725
- E2e Testing Automation695
- Business Case Development683
- React Component Architecture683
- Docker Containerization681
- Agile Sprint Planning677
- Log Analysis674
- Security Compliance Audit673
- Project Estimation670
- Gitlab Cicd Pipeline669
- Websocket Implementation668
- Requirements Gathering663
- Image Optimization662
- Ruby Rails Application660
- Api Rate Limiting647
- Internationalization I18n642
- Information Architecture641
- Backup Disaster Recovery626
- Github Actions Workflow626
- Color Accessibility624
- Fastapi Development624
- Static Code Analysis622
- Unit Testing Framework622