aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/json.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-28 21:52:09 +0800
committerobscuren <geffobscura@gmail.com>2015-01-28 21:52:09 +0800
commitb46e1ca97e61ebfe4c37961e723142245efe5016 (patch)
tree45838760ad08592995cd1051c29c6d41d08cd24c /rpc/json.go
parent159c4d56cd82d6fe721058557977f4efda31661c (diff)
parente9d017ba082bfd624267c974fa93a77da6269756 (diff)
downloaddexon-b46e1ca97e61ebfe4c37961e723142245efe5016.tar.gz
dexon-b46e1ca97e61ebfe4c37961e723142245efe5016.tar.zst
dexon-b46e1ca97e61ebfe4c37961e723142245efe5016.zip
Merge branch 'jsonrpc' of github.com-obscure:ethereum/go-ethereum into jsonrpc
Diffstat (limited to 'rpc/json.go')
-rw-r--r--rpc/json.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/rpc/json.go b/rpc/json.go
index 5446cb3c1..9bd204818 100644
--- a/rpc/json.go
+++ b/rpc/json.go
@@ -18,25 +18,28 @@ package rpc
import (
"encoding/json"
+ "github.com/ethereum/go-ethereum/logger"
"io"
"net/http"
)
-type jsonWrapper struct{}
+var rpclogger = logger.NewLogger("RPC")
-func (self jsonWrapper) Send(writer io.Writer, v interface{}) (n int, err error) {
+type JsonWrapper struct{}
+
+func (self JsonWrapper) Send(writer io.Writer, v interface{}) (n int, err error) {
var payload []byte
payload, err = json.Marshal(v)
if err != nil {
- jsonlogger.Fatalln("Error marshalling JSON", err)
+ rpclogger.Fatalln("Error marshalling JSON", err)
return 0, err
}
- jsonlogger.Infof("Sending payload: %s", payload)
+ rpclogger.Infof("Sending payload: %s", payload)
return writer.Write(payload)
}
-func (self jsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error) {
+func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error) {
var reqParsed RpcRequest
// Convert JSON to native types
@@ -46,12 +49,10 @@ func (self jsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error)
err := d.Decode(&reqParsed)
if err != nil {
- jsonlogger.Errorln("Error decoding JSON: ", err)
+ rpclogger.Errorln("Error decoding JSON: ", err)
return reqParsed, err
}
- jsonlogger.DebugDetailf("Parsed request: %s", reqParsed)
+ rpclogger.DebugDetailf("Parsed request: %s", reqParsed)
return reqParsed, nil
}
-
-var JSON jsonWrapper