|
|
@ -33,7 +33,7 @@ func Server(opts ...Option) middleware.Middleware { |
|
|
|
for _, o := range opts { |
|
|
|
for _, o := range opts { |
|
|
|
o(&options) |
|
|
|
o(&options) |
|
|
|
} |
|
|
|
} |
|
|
|
log := log.NewHelper("middleware/logging", options.logger) |
|
|
|
logger := log.NewHelper("middleware/logging", options.logger) |
|
|
|
return func(handler middleware.Handler) middleware.Handler { |
|
|
|
return func(handler middleware.Handler) middleware.Handler { |
|
|
|
return func(ctx context.Context, req interface{}) (interface{}, error) { |
|
|
|
return func(ctx context.Context, req interface{}) (interface{}, error) { |
|
|
|
var ( |
|
|
|
var ( |
|
|
@ -55,7 +55,7 @@ func Server(opts ...Option) middleware.Middleware { |
|
|
|
} |
|
|
|
} |
|
|
|
reply, err := handler(ctx, req) |
|
|
|
reply, err := handler(ctx, req) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Errorw( |
|
|
|
logger.Errorw( |
|
|
|
"kind", "server", |
|
|
|
"kind", "server", |
|
|
|
"component", component, |
|
|
|
"component", component, |
|
|
|
"path", path, |
|
|
|
"path", path, |
|
|
@ -66,7 +66,7 @@ func Server(opts ...Option) middleware.Middleware { |
|
|
|
) |
|
|
|
) |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
log.Infow( |
|
|
|
logger.Infow( |
|
|
|
"kind", "server", |
|
|
|
"kind", "server", |
|
|
|
"component", component, |
|
|
|
"component", component, |
|
|
|
"path", path, |
|
|
|
"path", path, |
|
|
@ -87,7 +87,7 @@ func Client(opts ...Option) middleware.Middleware { |
|
|
|
for _, o := range opts { |
|
|
|
for _, o := range opts { |
|
|
|
o(&options) |
|
|
|
o(&options) |
|
|
|
} |
|
|
|
} |
|
|
|
log := log.NewHelper("middleware/logging", options.logger) |
|
|
|
logger := log.NewHelper("middleware/logging", options.logger) |
|
|
|
return func(handler middleware.Handler) middleware.Handler { |
|
|
|
return func(handler middleware.Handler) middleware.Handler { |
|
|
|
return func(ctx context.Context, req interface{}) (interface{}, error) { |
|
|
|
return func(ctx context.Context, req interface{}) (interface{}, error) { |
|
|
|
var ( |
|
|
|
var ( |
|
|
@ -109,7 +109,7 @@ func Client(opts ...Option) middleware.Middleware { |
|
|
|
} |
|
|
|
} |
|
|
|
reply, err := handler(ctx, req) |
|
|
|
reply, err := handler(ctx, req) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Errorw( |
|
|
|
logger.Errorw( |
|
|
|
"kind", "client", |
|
|
|
"kind", "client", |
|
|
|
"component", component, |
|
|
|
"component", component, |
|
|
|
"path", path, |
|
|
|
"path", path, |
|
|
@ -120,7 +120,7 @@ func Client(opts ...Option) middleware.Middleware { |
|
|
|
) |
|
|
|
) |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
log.Infow( |
|
|
|
logger.Infow( |
|
|
|
"kind", "client", |
|
|
|
"kind", "client", |
|
|
|
"component", component, |
|
|
|
"component", component, |
|
|
|
"path", path, |
|
|
|
"path", path, |
|
|
|