Settings

Theme

Upgrading DrizzleORM logging with AsyncLocalStorage

numeric.substack.com

28 points by bihla 6 days ago · 3 comments

Reader

nickdeis 5 days ago

I built something similar for handling transactions/savepoints in drizzle: https://github.com/nickdeis/drizzle-transaction-context

Other languages like python and golang have similar concepts, but AsyncLocalStorage has a really nice API suited for async programming. It also pairs really nice with drizzle's savepoint implementation since both AsyncLocalStorage and savepoints can be nested.

btown 10 hours ago

FYI AsyncLocalStorage is currently Node specific but there’s a Stage 2 proposal to bring this to JS generally: https://github.com/tc39/proposal-async-context

dfajgljsldkjag 10 hours ago

It is annoying that the library does not just give you the query duration by default. I like that this fix does not require messing with the library internals but it is still a bit of work to set up just to get basic logs.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection