fix(cmd): ensure structured logging for all commands (#985)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Cory LaNou
2026-01-12 12:04:56 -06:00
committed by GitHub
parent 33639d49f1
commit a2a160af7f
2 changed files with 4 additions and 2 deletions

View File

@@ -75,6 +75,8 @@ func (e *ConfigValidationError) Unwrap() error {
}
func main() {
initLog(os.Stdout, "INFO", "text")
m := NewMain()
if err := m.Run(context.Background(), os.Args[1:]); errors.Is(err, flag.ErrHelp) || errors.Is(err, errStop) {
os.Exit(1)

View File

@@ -37,6 +37,8 @@ func (c *RestoreCommand) Run(ctx context.Context, args []string) (err error) {
return fmt.Errorf("too many arguments")
}
initLog(os.Stdout, "INFO", "text")
// Parse timestamp, if specified.
if *timestampStr != "" {
if opt.Timestamp, err = time.Parse(time.RFC3339, *timestampStr); err != nil {
@@ -86,8 +88,6 @@ func (c *RestoreCommand) loadFromURL(ctx context.Context, replicaURL string, ifD
return nil, fmt.Errorf("output path required")
}
initLog(os.Stdout, "INFO", "text")
// Exit successfully if the output file already exists.
if _, err := os.Stat(opt.OutputPath); !os.IsNotExist(err) && ifDBNotExists {
return nil, errSkipDBExists