-
Notifications
You must be signed in to change notification settings - Fork 118
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
Expose req._startAt
and req._startTime
to be similar to morgan
#65
Comments
Also https://github.com/pinojs/pino-http/blob/master/logger.js#L63 could probably be changed so that it also sets |
The reason I need this is because I want record the time the request was received in a log, and this is the easiest approach, since this is a timer that starts when it is received and is also the same timer used for calculation of response time. |
Since we're modifying req objects we wanted to be as least invasive as possible we use a symbol because it's "more private". The |
This would require me to require the package and install it in my log parser, which I really didn't want to do, since the log parser I'm writing is a library to be published in npm. Edit: And it's also a parser that works in browsers. |
Prefixing with an underscore as morgan does is probably sufficient enough. |
We could expose it using That way you don't have to require the package, and we don't have add more noise to the req/res objects. I'd be happy to accept a PR for altering to |
https://github.com/expressjs/morgan/blob/master/index.js#L500-L508
The text was updated successfully, but these errors were encountered: