logging-best-practices

Solid

Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics

DevOps & Infrastructure 12 stars 0 forks Updated 4 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
37
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Logging Best Practices Skill Version: 1.0.0 ## Purpose This skill provides guidelines for implementing effective logging in applications. It focuses on **wide events** (also called canonical log lines) - a pattern where you emit a single, context-rich event per request per service, enabling powerful debugging and analytics. ## When to Apply Apply these guidelines when: - Writing or reviewing logging code - Adding console.log, logger.info, or similar - Designing logging strategy for new services - Setting up logging infrastructure ## Core Principles ### 1. Wide Events (CRITICAL) Emit **one context-rich event per request per service**. Instead of scattering log lines throughout your handler, consolidate everything into a single structured event emitted at request completion. ```typescript const wideEvent: Record<string, unknown> = { method: "POST", path: "/checkout", requestId: c.get("requestId"), timestamp: new Date().toISOString(), }; try { const user = await getUser(c.get("userId")); wideEvent.user = { id: user.id, subscription: user.subscription }; const cart = await getCart(user.id); wideEvent.cart = { total_cents: cart.total, item_count: cart.items.length }; wideEvent.status_code = 200; wideEvent.outcome = "success"; return c.json({ success: true }); } catch (error) { wideEvent.status_code = 500; wideEvent.outcome = "error"; wideEvent.error = { message: error.message, type: error.name }; throw error; } finally { wideEvent.dur...

Details

Author
Stormix
Repository
Stormix/transcripts-mcp
Created
5 days ago
Last Updated
4 days ago
Language
TypeScript
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category