error-logger

BarisSozen's avatarfrom BarisSozen

Structured JSON logging with correlation IDs for multi-service systems. Use when implementing logging, debugging failures, or tracing errors across services. Triggers on: add logging, error handling, debug failures, trace errors.

0stars🔀0forks📁View on GitHub🕐Updated Jan 6, 2026

When & Why to Use This Skill

This Claude skill provides a standardized framework for implementing structured JSON logging with correlation IDs, enabling seamless error tracing and high-fidelity debugging across distributed multi-service architectures. It helps developers maintain observability by enforcing consistent log formats and propagation patterns.

Use Cases

  • Distributed Tracing: Track a single request's journey across multiple microservices using unique correlation IDs to pinpoint exactly where a failure occurs in the stack.
  • Standardized Error Reporting: Implement a consistent JSON log structure across different programming languages and services to simplify log aggregation and analysis in tools like ELK, Datadog, or CloudWatch.
  • Incident Response: Rapidly debug production failures by filtering logs using specific operation prefixes (e.g., liq_, arb_) to isolate relevant events during critical system outages.
  • Log Infrastructure Setup: Establish a professional-grade logging policy for new projects, including defined log levels (ERROR, WARN, INFO, DEBUG) and context-rich metadata.
nameerror-logger
descriptionStructured JSON logging with correlation IDs for multi-service systems. Use when implementing logging, debugging failures, or tracing errors across services. Triggers on: add logging, error handling, debug failures, trace errors.

Error Logger

Structured JSON logging with correlation IDs for multi-service systems.

When to Use

  • Implementing logging infrastructure
  • Debugging failures across services
  • Tracing errors with correlation IDs
  • Adding error handling to operations
  • Reviewing logging patterns

Workflow

Step 1: Create Operation Context

Start operation with appropriate prefix (liq_, arb_, quo_, op_).

Step 2: Log with Context

Include correlation ID in all related log entries.

Step 3: Propagate Correlation ID

Pass via X-Correlation-ID header across services.


Log Format

{
  "timestamp": "2024-01-15T14:32:01.847Z",
  "level": "ERROR",
  "correlation_id": "liq_18d4f2a1_x7k9",
  "service": "rust-hotpath",
  "event_type": "TX_REVERT",
  "message": "Liquidation reverted",
  "context": {}
}

Correlation ID

Format: {prefix}_{timestamp_hex}_{random} Prefixes: liq_, arb_, quo_, op_

Usage

const ctx = log.startOperation('liq');
log.error(ctx, 'TX_REVERT', 'Failed', { tx_hash, gas_used });

// Propagate via HTTP
headers: { 'X-Correlation-ID': ctx.correlation_id }

Log Levels

Level Use For
ERROR Operation failures
WARN Retries, recoverable
INFO Normal operations
DEBUG Calculations