logging-best-practices

Define structured JSON logging guidelines with wide events and contextual data.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/MuhamadAnang/wareflow-project --skill logging-best-practices-muhamadanang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-best-practices
Source: https://github.com/MuhamadAnang/wareflow-project/tree/main/.agents/skills/logging-best-practices
Command: npx skills add https://github.com/MuhamadAnang/wareflow-project --skill logging-best-practices-muhamadanang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill addresses the challenge of creating effective logs that are crucial for debugging complex systems and performing in-depth analytics, by establishing clear guidelines for structured, context-rich logging.

Core Features & Use Cases

  • Wide Events: Promotes emitting a single, context-rich event per request per service for comprehensive debugging.
  • Contextual Data: Emphasizes including high cardinality, business context, and environment characteristics in logs.
  • Use Case: When a critical checkout service fails, this Skill's logging practices allow engineers to immediately pinpoint the exact user, their subscription tier, the cart value, and the specific deployment version that caused the error, enabling rapid resolution.

Quick Start

Apply the logging best practices skill to ensure all events include user context and environment details.

Frequently Asked Questions about logging-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are wide events in structured logging and how do they improve debugging?

Wide events in structured logging are single, context-rich events emitted per request per service. They improve debugging by consolidating high cardinality data, business context, and environment characteristics into one comprehensive JSON log line for rapid issue resolution.

How do I implement structured logging with canonical log lines for analytics?

Implement structured logging with canonical log lines by using a single logger instance and consistent JSON schema. Apply middleware patterns to reliably emit one wide event per request, ensuring all logs contain business context and environment characteristics for analytics.

What's the best way to include business context and high cardinality data in JSON logs?

The best way to include business context and high cardinality data in JSON logs is to establish a consistent schema for wide events. Capture user identifiers, subscription tiers, cart values, and deployment versions within a single structured event per request.

When do I need structured logging with wide events for my services?

You need structured logging with wide events when debugging complex systems or performing in-depth analytics. If a critical service fails and you must immediately pinpoint the exact user, environment, and deployment version causing the error, wide events provide the necessary context.

Does structured logging require middleware patterns for reliable event emission?

Structured logging benefits from middleware patterns for reliable event emission. By enforcing a single logger instance and consistent schema, middleware ensures context-rich wide events are uniformly emitted across requests without missing business or environment characteristics.

Why does my structured logging fail to provide enough context for debugging complex systems?

Structured logging fails to provide enough debugging context when events lack high cardinality data and business context. Without wide events containing user details, environment characteristics, and deployment versions in a consistent JSON schema, pinpointing critical service failures is impossible.