Modify logging
This commit is contained in:
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)
|
err = c.db.PutTx(tx, h, tx.Blocktime)
|
||||||
// do not return caching error, only log it
|
// do not return caching error, only log it
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Error("PutTx error ", err)
|
glog.Warning("PutTx ", tx.Txid, ",error ", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -416,18 +416,18 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) {
|
|||||||
f, ok := requestHandlers[req.Method]
|
f, ok := requestHandlers[req.Method]
|
||||||
if ok {
|
if ok {
|
||||||
data, err = f(s, c, req)
|
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 {
|
} else {
|
||||||
err = errors.New("unknown method")
|
glog.Warning("Client ", c.id, " onMessage ", req.Method, ": unknown method, data ", string(req.Params))
|
||||||
}
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user