1
0
Fork 0
mirror of https://github.com/sourcegraph/jsonrpc2.git synced 2026-06-16 04:04:56 +02:00
Commit graph

9 commits

Author SHA1 Message Date
Fazlul Shahriar
b9c1fbdb96
Fix logging of received response messages (#71)
As documented: OnRecv causes all requests received on conn to invoke
f(req, nil) and all responses to invoke f(req, resp).

Since OnRecv is called with both *Request and *Response being non-nil
when we're handling a response, we need to check that *Response is
non-nil before we check *Request is non-nil. This change just swaps the
two cases in the switch statement to fix the issue. For consistency,
I've swapped the cases for OnSend also, even when it's not needed.
2023-07-14 13:00:57 +02:00
Sam Herrmann
c9c77b6bb9
Add ability to set custom logger (#48)
Before this commit, a custom logger could be set with the LogMessages
function. However, by using LogMessages not only is a custom logger set
but also all received and sent messages are logged. Use cases exist
where a custom logger is desired to log errors but not all messages.
2021-11-19 10:30:03 +02:00
s3rj1k
81af42d766 minor logging fixes
Signed-off-by: s3rj1k <evasive.gyron@gmail.com>
2019-11-07 23:44:16 +02:00
s3rj1k
6053545ad1 use custom logger for internal logging
Signed-off-by: s3rj1k <evasive.gyron@gmail.com>
2019-11-03 22:30:34 +02:00
Sergey Mudrik
549eb959f0 Replaced log.Logger parameter by interface (#20) 2018-08-31 09:05:25 -07:00
Keegan Carruthers-Smith
a3d86c792f allow multiple OnRecv and OnSend 2018-05-01 19:02:17 +01:00
Keegan Carruthers-Smith
7e53931322 Use correct format string for ID
Audited all calls for Printf. Noticed the following in some logs

```
jsonrpc2 handler: sending response {1 %!d(string=) %!d(bool=false)}: jsonrpc2: connection is closed
```
2016-11-14 21:17:22 +02:00
Quinn Slack
6416f80f8f support string request IDs (in addition to numeric request IDs) 2016-11-06 07:12:05 -08:00
Quinn Slack
c04eec1600 initial commit 2016-10-11 15:56:18 +02:00