-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request - add generic request context object #42
Comments
Thanks for the positive feedback. I think |
@puzpuzpuz while |
Nothing prevents the context object to be empty initially and then the later middlewares/plugins/handlers could be simply reading and updating the context when necessary. I know that it sounds like a workaround, but the goal of In general, what you're describing is a general-purpose CLS API, which is what Does it make sense to go with one of those options in your case? |
Hi @puzpuzpuz understood. In that case I may have to look into using AsyncLocalStorage myself. Thanks for the response! |
@eugene-kim please let me know if you run into any issues or unclear documentation for |
Hello,
Thank you for the wonderful library. It's helped a bunch in terms of zeroing in on relevant log messages for a single request.
I have a feature request and was wondering what your thoughts might be around opening up
cls-rtracer
to have a generic request context object. Rather than simply providing an id that exists throughout the lifetime of the request, there's also a request context object that one can access and put in whatever they want.Example use case:
Applications that have authorized actions can store the authorized account's id in the request context once authorized. This allows apps to always log an
account_id
in a single place when relevant, making tracing all of an account's actions very convenient.The text was updated successfully, but these errors were encountered: