Is there a way to generically log a response? #1678
-
I've added basic logging to my HTTP REST API server using uWebSocket:
But this lacks HTTP status, byte size sent, number of headers, etc... Am I missing something? Any chance more info into the response would be possible? PS: BTW, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There is no logging because logging does not belong in a server library. If you want logging you can log whatever you want, using whatever logger or monitor as you want, as things happen. Logging is a separate problem, for a separate library. Logging is like religion - you can never get people to agree on anything so that's why it is kept as a separate problem to be solved according to policies of that company, in their ways. Logging is also extremely slow and often times make up the majority of overhead. We don't keep track of headers written, you have to log them as they are written in your wrapper if you want to. Moving data across threads is making your app slower, not faster. |
Beta Was this translation helpful? Give feedback.
Logging statistics must not add any overhead to the library for those not using logging. So if you want those statistics you have to keep them yourself as you add headers and receive body. There is no need to have the library track various statistics for those who don't want it. You can attach any user data to your response as you need.