diff --git a/enduro.toml b/enduro.toml index b69c5900..fba769ef 100644 --- a/enduro.toml +++ b/enduro.toml @@ -1,5 +1,6 @@ # This is the configuration file valid for the development environment. +verbosity = 2 debug = true debugListen = "127.0.0.1:9001" diff --git a/internal/collection/goa.go b/internal/collection/goa.go index c08fa37f..379fbc6f 100644 --- a/internal/collection/goa.go +++ b/internal/collection/goa.go @@ -349,7 +349,7 @@ func (w *goaWrapper) Download(ctx context.Context, p *goacollection.DownloadPayl } loc := bu.ResolveReference(rel).String() - w.logger.Info("Sending request to Archivematica Storage Service.", "loc", loc) + w.logger.V(1).Info("Sending request to Archivematica Storage Service.", "loc", loc) req, err := http.NewRequestWithContext(ctx, http.MethodGet, loc, nil) if err != nil { return nil, nil, &goacollection.CollectionNotfound{ID: p.ID, Message: "not_found"} diff --git a/main.go b/main.go index 2a4086b4..ab663880 100644 --- a/main.go +++ b/main.go @@ -74,7 +74,11 @@ func main() { } // Logging configuration. - logger := log.New(os.Stderr, log.WithName(appName), log.WithDebug(config.Debug)) + logger := log.New(os.Stderr, + log.WithName(appName), + log.WithDebug(config.Debug), + log.WithLevel(config.Verbosity), + ) defer log.Sync(logger) logger.Info("Starting...", "version", version, "pid", os.Getpid()) @@ -332,6 +336,7 @@ func main() { } type configuration struct { + Verbosity int Debug bool DebugListen string API api.Config @@ -373,16 +378,16 @@ func readConfig(v *viper.Viper, config *configuration, configFile string) (found found = true } if found && err != nil { - return found, fmt.Errorf("Failed to read configuration file: %w", err) + return found, fmt.Errorf("failed to read configuration file: %w", err) } err = v.Unmarshal(config) if err != nil { - return found, fmt.Errorf("Failed to unmarshal configuration: %w", err) + return found, fmt.Errorf("failed to unmarshal configuration: %w", err) } if err := config.Validate(); err != nil { - return found, fmt.Errorf("Failed to validate the provided config: %w", err) + return found, fmt.Errorf("failed to validate the provided config: %w", err) } return found, nil