Golang logging

From HoangNguyen0403/agent-skills-standard · View interactive version

Golang logging is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Standards for structured logging and observability in Golang. Use when adding structured logging or tracing to Go services.

How to use this skill

Skill file

Golang Logging Standards

**Priority: P1 (HIGH)**

Principles

Libraries

Workflow: Set Up Structured Logging

  1. Initialize structured logger at startup in main() with standard JSON output.
  2. Inject request correlation IDs (TraceID, RequestID) via middleware using typed context keys.
  3. Pass logger via context (logger.FromContext(ctx)) or constructor injection.
  4. Log once at the chosen owner; wrap errors in helpers without intermediate logging.

See slog setup and usage examples

Anti-Patterns

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.