Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Tracking api usage #47

Answered by thislooksfun
FoxxMD asked this question in Q&A
Mar 11, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Baking that into snoots itself is possible, but it's a lot of extra work for not a lot of reward, since making it generic enough to fit everyone's needs would add a lot of API surface. The good news though is that since you are working in Node there is actually already a way to do what you want, and it should even work with snoowrap: AsyncLocalStorage. ALS is a way to attach a piece of data to an async context, rather than a lexical scope. I've used it in multiple server-side projects for tracking a request / event id for better log tracing, but you can just as easily use it for what you're describing here. If all you need is a single value for what rule / action is currently running you …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@FoxxMD
Comment options

Answer selected by thislooksfun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants