stellar-deprecated / stex

DEPRECATED. An opinionated framework built on top of expressjs used to build better web services for stellar
Other
30 stars 11 forks source link

Provide a "unique request id" in stex.log #43

Open thejollyrogers opened 9 years ago

thejollyrogers commented 9 years ago

When a stex application recieves a request, it would be nice to attach a unique id to every log that arrises from that request. that way logs could be tracked by request id. the asynchronous nature of node makes this hard as you lose context in the callback after the event loop.

here's a potential solution or model we could use https://datahero.com/blog/2014/05/22/node-js-preserving-data-across-async-callbacks/

Ideally most of the functionality would be abstracted into Stex, and all the client would need to do is add some stex speicific middleware to their request chain, and any further call to Stex.log will automatically add that request id to the log.