dcsunny 4 lat temu
rodzic
commit
bd1866fb10
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      http/middleware/logging/logging.go

+ 5 - 1
http/middleware/logging/logging.go

@@ -58,7 +58,11 @@ func Server(opts ...Option) middleware.Middleware {
 				params = req.(fmt.Stringer).String()
 			}
 			fromPath := param.GetFromPath(ctx)
-			ctx = context2.AppendToContext(ctx, "from_path", fromPath+"|"+path)
+			if fromPath != "" {
+				ctx = context2.AppendToContext(ctx, "from_path", fromPath+"|"+path)
+			} else {
+				ctx = context2.AppendToContext(ctx, "from_path", path)
+			}
 			reply, err := handler(ctx, req)
 			if err != nil {
 				log.Errorw(