logging-best-practices

Guide structured JSON logging with log levels, context, and PII handling.

6|1|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/RepairYourTech/cfsa-antigravity --skill logging-best-practices-repairyourtech
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-best-practices
Source: https://github.com/RepairYourTech/cfsa-antigravity/tree/main/.agent/skills/logging-best-practices
Command: npx skills add https://github.com/RepairYourTech/cfsa-antigravity --skill logging-best-practices-repairyourtech

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides a comprehensive framework for implementing robust logging practices, ensuring your applications are observable, secure, and maintainable.

Core Features & Use Cases

  • Structured Logging: Implement JSON-formatted logs for easier parsing and analysis.
  • Log Levels: Configure and utilize standard log levels (DEBUG, INFO, WARN, ERROR, FATAL).
  • Contextual Logging: Enrich logs with request IDs, user information, and other relevant context.
  • PII Handling: Sanitize and mask sensitive data to ensure privacy and compliance.
  • Centralized Logging: Integrate with systems like ELK or CloudWatch for unified log management.
  • Distributed Tracing: Implement tracing to understand request flows across services.
  • Use Case: When debugging a production issue, you can quickly pinpoint the root cause by analyzing structured logs with full context and error details, even in a distributed system.

Quick Start

Implement structured JSON logging in your Node.js application using the Winston library.

Frequently Asked Questions about logging-best-practices

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

FAQPage Schema
What is structured logging and why use JSON formats for application logs?

Structured logging outputs log data in JSON formats, enabling easier parsing, filtering, and analysis. It replaces plain text logs to improve observability and debugging by maintaining consistent, machine-readable contextual information across your application.

How do I implement structured logging in Node.js, Python, and Go?

You can implement structured logging in Node.js, Python, and Go by configuring standard log levels and using libraries that output JSON. This Skill provides examples for formatting logs with contextual information like request IDs across these languages.

What is the best way to handle PII and sensitive data in application logs?

Handling PII in application logs requires sanitizing and masking sensitive data before logging. This ensures privacy and compliance by preventing unauthorized access to user information while maintaining enough context for effective debugging.

How does distributed tracing improve debugging in microservices?

Distributed tracing improves debugging by tracking request flows across multiple services. It complements centralized logging by linking structured logs with trace IDs, allowing you to pinpoint failure points in distributed systems quickly.

Can I integrate centralized logging with ELK or CloudWatch for observability?

Yes, you can integrate centralized logging with systems like ELK or CloudWatch. This unifies log management by aggregating structured JSON logs from your application, enabling comprehensive analysis and monitoring for production issues.