fix: use silent logger in TUI mode to prevent console conflicts
This commit is contained in:
@ -4,8 +4,8 @@ This directory contains pre-compiled binaries for the DB Backup Tool across mult
|
|||||||
|
|
||||||
## Build Information
|
## Build Information
|
||||||
- **Version**: 1.1.0
|
- **Version**: 1.1.0
|
||||||
- **Build Time**: 2025-11-05_13:06:25_UTC
|
- **Build Time**: 2025-11-05_13:20:08_UTC
|
||||||
- **Git Commit**: f2f6021
|
- **Git Commit**: 161f577
|
||||||
|
|
||||||
## Recent Updates (v1.1.0)
|
## Recent Updates (v1.1.0)
|
||||||
- ✅ Fixed TUI progress display with line-by-line output
|
- ✅ Fixed TUI progress display with line-by-line output
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -11,6 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"dbbackup/internal/logger"
|
||||||
"dbbackup/internal/tui"
|
"dbbackup/internal/tui"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@ -58,8 +59,9 @@ var interactiveCmd = &cobra.Command{
|
|||||||
Long: `Start the interactive menu system for guided backup operations.`,
|
Long: `Start the interactive menu system for guided backup operations.`,
|
||||||
Aliases: []string{"menu", "ui"},
|
Aliases: []string{"menu", "ui"},
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
// Start the interactive TUI
|
// Start the interactive TUI with silent logger to prevent console output conflicts
|
||||||
return tui.RunInteractiveMenu(cfg, log)
|
silentLog := logger.NewSilent()
|
||||||
|
return tui.RunInteractiveMenu(cfg, silentLog)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,20 @@ func New(level, format string) Logger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSilent creates a logger that discards all output (for TUI mode)
|
||||||
|
func NewSilent() Logger {
|
||||||
|
l := logrus.New()
|
||||||
|
l.SetLevel(logrus.InfoLevel)
|
||||||
|
l.SetOutput(io.Discard) // Discard all log output
|
||||||
|
l.SetFormatter(&CleanFormatter{})
|
||||||
|
|
||||||
|
return &logger{
|
||||||
|
logrus: l,
|
||||||
|
level: logrus.InfoLevel,
|
||||||
|
format: "text",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (l *logger) Debug(msg string, args ...any) {
|
func (l *logger) Debug(msg string, args ...any) {
|
||||||
l.logWithFields(logrus.DebugLevel, msg, args...)
|
l.logWithFields(logrus.DebugLevel, msg, args...)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user