mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 15:04:22 +00:00
logging: remove reamining instances of SetLogger interface (#7572)
This commit is contained in:
@@ -41,6 +41,7 @@ type WebsocketManager struct {
|
||||
// NewWebsocketManager returns a new WebsocketManager that passes a map of
|
||||
// functions, connection options and logger to new WS connections.
|
||||
func NewWebsocketManager(
|
||||
logger log.Logger,
|
||||
funcMap map[string]*RPCFunc,
|
||||
wsConnOptions ...func(*wsConnection),
|
||||
) *WebsocketManager {
|
||||
@@ -60,16 +61,11 @@ func NewWebsocketManager(
|
||||
return true
|
||||
},
|
||||
},
|
||||
logger: log.NewNopLogger(),
|
||||
logger: logger,
|
||||
wsConnOptions: wsConnOptions,
|
||||
}
|
||||
}
|
||||
|
||||
// SetLogger sets the logger.
|
||||
func (wm *WebsocketManager) SetLogger(l log.Logger) {
|
||||
wm.logger = l
|
||||
}
|
||||
|
||||
// WebsocketHandler upgrades the request/response (via http.Hijack) and starts
|
||||
// the wsConnection.
|
||||
func (wm *WebsocketManager) WebsocketHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -49,9 +49,7 @@ func newWSServer(t *testing.T, logger log.Logger) *httptest.Server {
|
||||
funcMap := map[string]*RPCFunc{
|
||||
"c": NewWSRPCFunc(func(ctx context.Context, s string, i int) (string, error) { return "foo", nil }, "s,i"),
|
||||
}
|
||||
wm := NewWebsocketManager(funcMap)
|
||||
|
||||
wm.SetLogger(logger)
|
||||
wm := NewWebsocketManager(logger, funcMap)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/websocket", wm.WebsocketHandler)
|
||||
|
||||
Reference in New Issue
Block a user