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

2 years ago
  1. package gomicro
  2. import (
  3. "context"
  4. "github.com/micro/go-micro/v2/client"
  5. log "github.com/micro/go-micro/v2/logger"
  6. )
  7. type LogWrapper struct {
  8. client.Client
  9. }
  10. func (c *LogWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error {
  11. log.Infof("call service: %s(%s)", req.Service(), req.Endpoint())
  12. return c.Client.Call(ctx, req, rsp)
  13. }
  14. func NewLogWrapper(c client.Client) client.Client {
  15. return &LogWrapper{c}
  16. }