mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-30 18:48:39 -04:00
deps: convert zap to slog (#2825)
This commit is contained in:
parent
3765cb0762
commit
54cce77bab
182 changed files with 1474 additions and 1509 deletions
|
@ -8,12 +8,12 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/hack/oci-pin/internal/sums"
|
||||
"github.com/edgelesssys/constellation/v2/internal/logger"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
func newMergeCmd() *cobra.Command {
|
||||
|
@ -35,10 +35,10 @@ func runMerge(cmd *cobra.Command, _ []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log := logger.New(logger.PlainLog, flags.logLevel)
|
||||
log.Debugf("Parsed flags: %+v", flags)
|
||||
log := logger.NewTextLogger(flags.logLevel)
|
||||
log.Debug(fmt.Sprintf("Parsed flags: %+v", flags))
|
||||
|
||||
log.Debugf("Merging sum file from %q into %q.", flags.inputs, flags.output)
|
||||
log.Debug(fmt.Sprintf("Merging sum file from %q into %q.", flags.inputs, flags.output))
|
||||
|
||||
var out io.Writer
|
||||
if flags.output == "-" {
|
||||
|
@ -61,7 +61,7 @@ func runMerge(cmd *cobra.Command, _ []string) error {
|
|||
return fmt.Errorf("creating merged sum file: %w", err)
|
||||
}
|
||||
|
||||
log.Debugf("Sum file created at %q 🤖", flags.output)
|
||||
log.Debug(fmt.Sprintf("Sum file created at %q 🤖", flags.output))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ func parseInput(input string) ([]sums.PinnedImageReference, error) {
|
|||
type mergeFlags struct {
|
||||
inputs []string
|
||||
output string
|
||||
logLevel zapcore.Level
|
||||
logLevel slog.Level
|
||||
}
|
||||
|
||||
func parseMergeFlags(cmd *cobra.Command) (mergeFlags, error) {
|
||||
|
@ -109,9 +109,9 @@ func parseMergeFlags(cmd *cobra.Command) (mergeFlags, error) {
|
|||
if err != nil {
|
||||
return mergeFlags{}, err
|
||||
}
|
||||
logLevel := zapcore.InfoLevel
|
||||
logLevel := slog.LevelInfo
|
||||
if verbose {
|
||||
logLevel = zapcore.DebugLevel
|
||||
logLevel = slog.LevelDebug
|
||||
}
|
||||
|
||||
return mergeFlags{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue