mirror of
https://github.com/benbjohnson/litestream.git
synced 2026-01-25 05:06:30 +00:00
fix(cmd): ensure structured logging for all commands (#985)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user