You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
468 B
21 lines
468 B
package gomicro
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/micro/go-micro/v2/client"
|
|
log "github.com/micro/go-micro/v2/logger"
|
|
)
|
|
|
|
type LogWrapper struct {
|
|
client.Client
|
|
}
|
|
|
|
func (c *LogWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error {
|
|
log.Infof("call service: %s(%s)", req.Service(), req.Endpoint())
|
|
return c.Client.Call(ctx, req, rsp)
|
|
}
|
|
|
|
func NewLogWrapper(c client.Client) client.Client {
|
|
return &LogWrapper{c}
|
|
}
|