review-logging-patterns

Review TypeScript codebases for logging anti-patterns and guide evlog structured logging adoption.

Updated Sep 5, 2023
One-click install
npx skills add https://github.com/eyenalxai/dotfiles --skill review-logging-patterns-eyenalxai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: review-logging-patterns
Source: https://github.com/eyenalxai/dotfiles/tree/main/.agents/skills/review-logging-patterns
Command: npx skills add https://github.com/eyenalxai/dotfiles --skill review-logging-patterns-eyenalxai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires evlog, @evlog/cli, and includes references (resource) components.

What problem does it solve? Scattered console.log statements, generic errors, and missing request context make production debugging painful. This Skill reviews TypeScript/JavaScript codebases for logging anti-patterns and guides adoption of evlog's wide events and structured errors across 15+ frameworks. ## Core Features & Use Cases - Logging Code Review: Detects console.log spam, unstructured errors, and missing request context, with before/after transformation examples for each anti-pattern. - Framework Setup Guides: Step-by-step evlog integration for Nuxt, Nitro, Next.js, SvelteKit, TanStack Start, NestJS, Express, Hono, Fastify, Elysia, React Router, oRPC, Cloudflare Workers, AWS Lambda, Astro, and standalone TypeScript. - CLI-Driven Coverage: Uses @evlog/cli (evlog init, evlog map, --baseline) to wire evlog, score entry-point coverage, and gate regressions in CI. - Use Case: A team migrating an Express API to structured logging can have the Skill scan handlers, replace console.logs with wide events via useLogger(), convert throw new Error() into createError({ why, fix }), and configure an Axiom drain with batching and retry. ## Quick Start Ask the assistant to review your API route handlers for logging anti-patterns and suggest evlog wide-event and structured-error improvements.

Frequently Asked Questions about review-logging-patterns

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

FAQPage Schema
How do I replace console.log with structured logging in TypeScript?

Replace scattered console.log calls with a request-scoped wide event using evlog's useLogger() and log.set() to accumulate context, emitted once per request. The Skill provides before/after transformation examples for single logs, multiple related logs, and full request lifecycles.

How do I add structured logging to a Next.js or Nuxt app?

For Nuxt, add the evlog/nuxt module and use auto-imported useLogger(event) in handlers. For Next.js, create a central config with createEvlog() from evlog/next and wrap route handlers with withEvlog(). The @evlog/cli init command can automate setup on both.

Does evlog work with Express, Hono, or Fastify?

Yes, evlog provides dedicated middleware for Express, Hono, Fastify, Elysia, NestJS, React Router, oRPC, SvelteKit, Astro, Cloudflare Workers, and AWS Lambda. Each integration exposes a request-scoped logger via useLogger() or the framework's context object.

What is a wide event in logging?

A wide event is a single comprehensive log entry capturing all context for one logical operation, such as user, cart, payment, and error data for a request. It replaces many scattered log lines, making incident debugging faster since everything is in one structured event.

How do I send evlog logs to Axiom, Datadog, or Sentry?

evlog includes drain adapters for Axiom, OTLP, HyperDX, PostHog, Sentry, Better Stack, Datadog, Loki, and ClickHouse, configured via environment variables. Wrap the adapter in createDrainPipeline for batching, retry with backoff, and buffer overflow protection in production.

When should I not use wide events?

Avoid wide events for granular operations like individual database queries or cache hits; include those as context in the parent request's wide event instead. Also never log sensitive data such as passwords, tokens, or full card numbers in any event.