chore: avoid double API request logging in trustd

There's a common logger for API calls already working, so no need to log
in the token authenticator.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Andrey Smirnov 2022-09-08 14:18:39 +04:00
parent f62d17125b
commit e626540dfb
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD

View File

@ -7,8 +7,6 @@ package basic
import (
"context"
"fmt"
"log"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@ -81,20 +79,10 @@ func (b *TokenCredentials) authenticate(ctx context.Context) error {
// basic authentication.
func (b *TokenCredentials) UnaryInterceptor() grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
start := time.Now()
if err := b.authenticate(ctx); err != nil {
return nil, err
}
h, err := handler(ctx, req)
log.Printf("request - Method:%s\tDuration:%s\tError:%v\n",
info.FullMethod,
time.Since(start),
err,
)
return h, err
return handler(ctx, req)
}
}