From 94247feea018818c05d980edd3c43e3497d7057b Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Tue, 23 Jul 2024 14:48:22 +0800 Subject: [PATCH] added log Signed-off-by: Patrick Zheng --- cmd/notation/sign.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/notation/sign.go b/cmd/notation/sign.go index 40c95102..30b4e0a6 100644 --- a/cmd/notation/sign.go +++ b/cmd/notation/sign.go @@ -24,6 +24,7 @@ import ( corex509 "github.com/notaryproject/notation-core-go/x509" "github.com/notaryproject/notation-go" + "github.com/notaryproject/notation-go/log" "github.com/notaryproject/notation/cmd/notation/internal/experimental" "github.com/notaryproject/notation/internal/cmd" "github.com/notaryproject/notation/internal/envelope" @@ -198,6 +199,8 @@ func runSign(command *cobra.Command, cmdOpts *signOpts) error { } func prepareSigningOpts(ctx context.Context, opts *signOpts) (notation.SignOptions, error) { + logger := log.GetLogger(ctx) + mediaType, err := envelope.GetEnvelopeMediaType(opts.SignerFlagOpts.SignatureFormat) if err != nil { return notation.SignOptions{}, err @@ -220,7 +223,7 @@ func prepareSigningOpts(ctx context.Context, opts *signOpts) (notation.SignOptio } if opts.tsaServerURL != "" { // timestamping - fmt.Printf("Configured to timestamp with TSA %q\n", opts.tsaServerURL) + logger.Infof("Configured to timestamp with TSA %q", opts.tsaServerURL) signOpts.Timestamper, err = tspclient.NewHTTPTimestamper(httputil.NewClient(ctx, &http.Client{Timeout: timestampingTimeout}), opts.tsaServerURL) if err != nil { return notation.SignOptions{}, fmt.Errorf("cannot get http timestamper for timestamping: %w", err)