mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-11 15:39:33 -05:00
cli: also log applier debug messages to debug log file (#3457)
* cli: also log applier debug messages to debug log file * cli: use debug logger instead of cliLogger
This commit is contained in:
parent
cbd8cc6976
commit
2cd5b05b51
@ -211,10 +211,6 @@ func (f *applyFlags) parse(flags *pflag.FlagSet) error {
|
|||||||
|
|
||||||
// runApply sets up the apply command and runs it.
|
// runApply sets up the apply command and runs it.
|
||||||
func runApply(cmd *cobra.Command, _ []string) error {
|
func runApply(cmd *cobra.Command, _ []string) error {
|
||||||
log, err := newCLILogger(cmd)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("creating logger: %w", err)
|
|
||||||
}
|
|
||||||
spinner, err := newSpinnerOrStderr(cmd)
|
spinner, err := newSpinnerOrStderr(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -227,7 +223,7 @@ func runApply(cmd *cobra.Command, _ []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileHandler := file.NewHandler(afero.NewOsFs())
|
fileHandler := file.NewHandler(afero.NewOsFs())
|
||||||
logger, err := newDebugFileLogger(cmd, fileHandler)
|
debugLogger, err := newDebugFileLogger(cmd, fileHandler)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -250,15 +246,15 @@ func runApply(cmd *cobra.Command, _ []string) error {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
applier := constellation.NewApplier(log, spinner, constellation.ApplyContextCLI, newDialer)
|
applier := constellation.NewApplier(debugLogger, spinner, constellation.ApplyContextCLI, newDialer)
|
||||||
|
|
||||||
apply := &applyCmd{
|
apply := &applyCmd{
|
||||||
fileHandler: fileHandler,
|
fileHandler: fileHandler,
|
||||||
flags: flags,
|
flags: flags,
|
||||||
log: logger,
|
log: debugLogger,
|
||||||
wLog: &warnLogger{cmd: cmd, log: log},
|
wLog: &warnLogger{cmd: cmd, log: debugLogger},
|
||||||
spinner: spinner,
|
spinner: spinner,
|
||||||
merger: &kubeconfigMerger{log: log},
|
merger: &kubeconfigMerger{log: debugLogger},
|
||||||
newInfraApplier: newInfraApplier,
|
newInfraApplier: newInfraApplier,
|
||||||
imageFetcher: imagefetcher.New(),
|
imageFetcher: imagefetcher.New(),
|
||||||
applier: applier,
|
applier: applier,
|
||||||
@ -826,6 +822,7 @@ func (wl warnLogger) Info(msg string, args ...any) {
|
|||||||
// Warn prints a formatted warning from the validator.
|
// Warn prints a formatted warning from the validator.
|
||||||
func (wl warnLogger) Warn(msg string, args ...any) {
|
func (wl warnLogger) Warn(msg string, args ...any) {
|
||||||
wl.cmd.PrintErrf("Warning: %s %s\n", msg, fmt.Sprint(args...))
|
wl.cmd.PrintErrf("Warning: %s %s\n", msg, fmt.Sprint(args...))
|
||||||
|
wl.log.Debug(msg, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
type warnLog interface {
|
type warnLog interface {
|
||||||
|
Loading…
Reference in New Issue
Block a user