aboutsummaryrefslogtreecommitdiff
path: root/rpc/middleware.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/middleware.go')
-rw-r--r--rpc/middleware.go21
1 files changed, 0 insertions, 21 deletions
diff --git a/rpc/middleware.go b/rpc/middleware.go
index cd99823..3887109 100644
--- a/rpc/middleware.go
+++ b/rpc/middleware.go
@@ -19,25 +19,4 @@
package rpc
-import (
- "context"
- "strings"
- "time"
-)
-
type Middleware func(handler RpcHandler) RpcHandler
-
-type RpcHandler func(ctx context.Context, req *RpcRequest) *RpcResponse
-
-func LoggerMiddleware(logger Logger) Middleware {
- return func(handler RpcHandler) RpcHandler {
- return func(ctx context.Context, req *RpcRequest) *RpcResponse {
- t1 := time.Now().UnixMicro()
- resp := handler(ctx, req)
- t2 := time.Now().UnixMicro()
- args := strings.ReplaceAll(string(req.Params), "\n", "")
- logger.Logf("rpc call=%s, args=%s, take=%dμs", req.Method, args, (t2 - t1))
- return resp
- }
- }
-}