Modify logging
parent
01d8e48e73
commit
76324be8ec
|
@ -92,7 +92,7 @@ func (c *TxCache) GetTransaction(txid string) (*bchain.Tx, int, error) {
|
|||
err = c.db.PutTx(tx, h, tx.Blocktime)
|
||||
// do not return caching error, only log it
|
||||
if err != nil {
|
||||
glog.Error("PutTx error ", err)
|
||||
glog.Warning("PutTx ", tx.Txid, ",error ", err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -416,18 +416,18 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) {
|
|||
f, ok := requestHandlers[req.Method]
|
||||
if ok {
|
||||
data, err = f(s, c, req)
|
||||
if err == nil {
|
||||
glog.V(1).Info("Client ", c.id, " onRequest ", req.Method, " success")
|
||||
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "success"}).Inc()
|
||||
} else {
|
||||
glog.Error("Client ", c.id, " onMessage ", req.Method, ": ", errors.ErrorStack(err), ", data ", string(req.Params))
|
||||
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "failure"}).Inc()
|
||||
e := resultError{}
|
||||
e.Error.Message = err.Error()
|
||||
data = e
|
||||
}
|
||||
} else {
|
||||
err = errors.New("unknown method")
|
||||
}
|
||||
if err == nil {
|
||||
glog.V(1).Info("Client ", c.id, " onRequest ", req.Method, " success")
|
||||
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "success"}).Inc()
|
||||
} else {
|
||||
glog.Error("Client ", c.id, " onMessage ", req.Method, ": ", errors.ErrorStack(err), ", data ", string(req.Params))
|
||||
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "failure"}).Inc()
|
||||
e := resultError{}
|
||||
e.Error.Message = err.Error()
|
||||
data = e
|
||||
glog.Warning("Client ", c.id, " onMessage ", req.Method, ": unknown method, data ", string(req.Params))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue