mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-05 07:45:27 -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
|
@ -7,25 +7,25 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/logger"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
type debugLog interface {
|
||||
Debugf(format string, args ...any)
|
||||
Sync()
|
||||
Debug(msg string, args ...any)
|
||||
}
|
||||
|
||||
func newCLILogger(cmd *cobra.Command) (debugLog, error) {
|
||||
logLvl := zapcore.InfoLevel
|
||||
logLvl := slog.LevelInfo
|
||||
debugLog, err := cmd.Flags().GetBool("debug")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if debugLog {
|
||||
logLvl = zapcore.DebugLevel
|
||||
logLvl = slog.LevelDebug
|
||||
}
|
||||
|
||||
return logger.New(logger.PlainLog, logLvl), nil
|
||||
return logger.NewTextLogger(logLvl), nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue