Skip to content

Commit

Permalink
fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Oct 16, 2023
1 parent 0d8d360 commit f0e1625
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ func main() {
func UnaryRequestLogger(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
start := time.Now()
resp, err := handler(ctx, req)
fields := log.Fields{"elapsed": time.Now().Sub(start)}
fields := log.Fields{"elapsed": time.Since(start)}
log.WithContext(ctx).WithFields(fields).WithError(err).Info(info.FullMethod)
return resp, err
}
func StreamRequestLogger(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
start := time.Now()
err := handler(srv, stream)
log.WithField("elapsed", time.Now().Sub(start)).WithError(err).Info(info.FullMethod)
log.WithField("elapsed", time.Since(start)).WithError(err).Info(info.FullMethod)
return err
}

Expand Down

0 comments on commit f0e1625

Please sign in to comment.