@trace-dev/reporter-terminal
v0.1.1
Published
trace-dev terminal reporter — flat/tree/timeline views with color coding and a slow-operation summary.
Readme
@trace-dev/reporter-terminal
trace-dev's default reporter — prints
a color-coded trace to your terminal the instant each request finishes. Installed
automatically as part of @trace-dev/core (it's the default reporters entry) — you
only need this package directly for advanced/manual use.
────────────────────────────────────────────────
POST /employees
Request ID
7d219e
Total Duration
2.82s
Operations
🟢 Validation
6ms
🟡 prisma.user.findUnique()
65ms
🟠 Axios POST https://api.slack.com
456ms
🔴 Send Email
1.61s
📍 src/services/mailService.ts:4
Summary
Slowest operation: Send Email (1.61s)
Total DB time: 719ms
Total HTTP time: 456ms
────────────────────────────────────────────────Color coding
| Duration | Color | |---|---| | < 50ms | 🟢 green | | 50–200ms | 🟡 yellow | | 200ms–1s | 🟠 orange | | > 1s | 🔴 red |
Respects NO_COLOR and non-TTY output automatically; override via
config.colors: "auto" \| "always" \| "never".
Views
Three interchangeable ways to render the same trace, via config.terminal.view:
"flat"(default) — operations in start-time order, matching the example above."tree"— indented├──/└──connectors showing parent/child nesting."timeline"— a proportional ASCII bar per operation type, positioned by offset from the request start.
import { initTracer } from "@trace-dev/core";
initTracer({ terminal: { view: "tree" } });Also included
- 📍
file:linelocations, wrapped in an OSC 8 terminal hyperlink where supported (iTerm2, VS Code's integrated terminal, Windows Terminal) — clickable today. - A summary block: slowest operation, total DB/HTTP/cache time.
- Sequential-await and N+1 insights, printed after the operations list.
License
MIT
