January 14, 2026
Logs, not hacks
Upgrading DrizzleORM logging with AsyncLocalStorage
Async ‘magic’ saves Drizzle logs; devs cheer while skeptics snark
TLDR: A developer boosted DrizzleORM logging using Node’s AsyncLocalStorage to keep context across requests. Commenters applauded and shared similar tools, while skeptics warned about complexity—important because better logs mean easier debugging, faster apps, and fewer risky hacks.
DrizzleORM’s logging woes got a spicy glow‑up when a developer pulled out Node’s AsyncLocalStorage—a feature that keeps “context” flowing through async code like a GPS for your app—to finally capture timing, row counts, and clean SQL in one tidy log line. The community instantly split into two camps: “Finally, real logs!” and “Careful, that magic can bite.” The “oof” of Drizzle’s minimal logging—filed under “Goodies,” no less—became the punchline, with readers dunking on prototype hacks and praising a solution that doesn’t glue itself to fragile internals.
The top vibe: relief with a side of swagger. Commenter nickdeis dropped a link to a similar transaction tool and blessed AsyncLocalStorage as tailor‑made for async code. Others joked it’s basically “useContext for servers”, while old‑school pragmatists muttered, “Or just stick with slonik.” There’s skepticism too: will this stay clean as apps grow, or become a spooky context maze? But roasted prototype monkey‑patches united the crowd—no one wants logging that explodes at 2 a.m.
In short, AsyncLocalStorage turned a logging blind spot into a flex, and the comments turned it into a meme: less hack, more stack context.
Key Points
- •DrizzleORM’s logging API only provides a pre-execution handler with access to query and arguments, preventing timing and result logging.
- •The team requires log lines with a unique query key, execution time, sanitized SQL, sanitized args and count, and row count.
- •Previous tooling (slonik) supported comprehensive logging used in Datadog for monitoring and debugging.
- •A GitHub-suggested workaround involves prototype manipulation of node-postgres internals, which the article rejects as fragile.
- •Node.js AsyncLocalStorage enables context propagation across async calls, allowing completion of log lines with execution and result data.