Skip to content

Commit

Permalink
Reformat log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
pogzyb committed Jan 22, 2025
1 parent c597b6e commit 9568b74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions cmd/downloadAll.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func DownloadAll(username, password, outputDir string, workers int) {
// Authentication with ICANN
accessToken, err := auth.GetAccessToken(ctx, username, password)
if err != nil {
log.Fatal().Msg(fmt.Sprintf("could not get access token from ICANN: %v", err))
log.Fatal().Msgf("could not get access token from ICANN: %v", err)
}
// Channel size determines download concurrency
zonesQueue := make(chan string, workers)
Expand All @@ -64,22 +64,22 @@ func DownloadAll(username, password, outputDir string, workers int) {
tld := download.GetTLDFromURL(zoneURL)
outputFile, err := download.GetOutputFile(outputDir, tld)
if err != nil {
log.Fatal().Msg(fmt.Sprintf("could not prepare output file: %s err: %v", outputDir, err))
log.Fatal().Msgf("could not prepare output file: %s err: %v", outputDir, err)
}
// init the loader
loader, err := download.NewLoader(outputFile, zoneURL, workers/2)
if err != nil {
log.Debug().Msg(fmt.Sprintf("could not get loader: %v", err))
log.Debug().Msgf("could not get loader: %v", err)
continue
}
log.Info().Msg(fmt.Sprintf("Downloading %s", zoneURL))
log.Info().Msgf("Downloading %s", zoneURL)
// download and save
err = loader.DownloadZone(ctx, accessToken)
if err != nil {
log.Debug().Msg(fmt.Sprintf("could not download: %s: %v", zoneURL, err))
continue
}
log.Info().Msg(fmt.Sprintf("Saved %s", outputFile))
log.Info().Msgf("Saved %s", outputFile)
}
}()
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/downloadOne.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,27 @@ func DownloadOne(username, password, outputDir, zone string, workers int) {
go func() {
defer func() { done <- struct{}{} }()
zoneURL := fmt.Sprintf("https://czds-download-api.icann.org/czds/downloads/%s.zone", zone)
log.Info().Msg(fmt.Sprintf("Downloading %s", zoneURL))
log.Info().Msgf("Downloading %s", zoneURL)
if ctx.Err() != nil {
return
}
outputFile, err := download.GetOutputFile(outputDir, zone)
if err != nil {
log.Fatal().Msg(fmt.Sprintf("could not prepare output file: %s err: %v", outputDir, err))
log.Fatal().Msgf("could not prepare output file: %s err: %v", outputDir, err)
}
// init the loader
loader, err := download.NewLoader(outputFile, zoneURL, workers)
if err != nil {
log.Debug().Msg(fmt.Sprintf("could not get loader: %v", err))
log.Debug().Msgf("could not get loader: %v", err)
return
}
// download and save
err = loader.DownloadZone(ctx, accessToken)
if err != nil {
log.Debug().Msg(fmt.Sprintf("could not download: %s: %v", zoneURL, err))
log.Debug().Msgf("could not download: %s: %v", zoneURL, err)
return
}
log.Info().Msg(fmt.Sprintf("Saved %s", outputFile))
log.Info().Msgf("Saved %s", outputFile)
}()
for {
// Wait for completion
Expand Down

0 comments on commit 9568b74

Please sign in to comment.