deps: convert zap to slog (#2825)

This commit is contained in:
miampf 2024-02-08 14:20:01 +00:00 committed by GitHub
parent 3765cb0762
commit 54cce77bab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
182 changed files with 1474 additions and 1509 deletions

View file

@ -13,8 +13,8 @@ package kms
import (
"context"
"fmt"
"log/slog"
"github.com/edgelesssys/constellation/v2/internal/logger"
"github.com/edgelesssys/constellation/v2/keyservice/keyserviceproto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@ -22,13 +22,13 @@ import (
// Client interacts with Constellation's keyservice.
type Client struct {
log *logger.Logger
log *slog.Logger
endpoint string
grpc grpcClient
}
// New creates a new KMS.
func New(log *logger.Logger, endpoint string) Client {
func New(log *slog.Logger, endpoint string) Client {
return Client{
log: log,
endpoint: endpoint,
@ -41,14 +41,14 @@ func (c Client) GetDataKey(ctx context.Context, keyID string, length int) ([]byt
log := c.log.With("keyID", keyID, "endpoint", c.endpoint)
// the KMS does not use aTLS since traffic is only routed through the Constellation cluster
// cluster internal connections are considered trustworthy
log.Infof("Connecting to KMS")
log.Info("Connecting to KMS")
conn, err := grpc.DialContext(ctx, c.endpoint, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, err
}
defer conn.Close()
log.Infof("Requesting data key")
log.Info("Requesting data key")
res, err := c.grpc.GetDataKey(
ctx,
&keyserviceproto.GetDataKeyRequest{
@ -61,7 +61,7 @@ func (c Client) GetDataKey(ctx context.Context, keyID string, length int) ([]byt
return nil, fmt.Errorf("fetching data encryption key from Constellation KMS: %w", err)
}
log.Infof("Data key request successful")
log.Info("Data key request successful")
return res.DataKey, nil
}