logging: unify debug log message format (#2997)

This commit is contained in:
miampf 2024-04-03 13:49:03 +00:00 committed by GitHub
parent 24c346c657
commit 840f460bac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 183 additions and 169 deletions

View file

@ -45,14 +45,14 @@ func runCodegen(cmd *cobra.Command, _ []string) error {
return err
}
log := logger.NewTextLogger(flags.logLevel)
log.Debug(fmt.Sprintf("Parsed flags: %+v", flags))
log.Debug("Using flags", "identifier", flags.identifier, "imageRepoTag", flags.imageRepoTag, "ociPath", flags.ociPath, "pkg", flags.pkg)
registry, prefix, name, tag, err := splitRepoTag(flags.imageRepoTag)
if err != nil {
return fmt.Errorf("splitting OCI image reference %q: %w", flags.imageRepoTag, err)
}
log.Debug(fmt.Sprintf("Generating Go code for OCI image %s.", name))
log.Debug(fmt.Sprintf("Generating Go code for OCI image %q.", name))
ociIndexPath := filepath.Join(flags.ociPath, "index.json")
index, err := os.Open(ociIndexPath)
@ -78,7 +78,7 @@ func runCodegen(cmd *cobra.Command, _ []string) error {
return err
}
log.Debug(fmt.Sprintf("OCI image digest: %s", digest))
log.Debug(fmt.Sprintf("OCI image digest: %q", digest))
if err := inject.Render(out, inject.PinningValues{
Package: flags.pkg,

View file

@ -36,7 +36,7 @@ func runMerge(cmd *cobra.Command, _ []string) error {
return err
}
log := logger.NewTextLogger(flags.logLevel)
log.Debug(fmt.Sprintf("Parsed flags: %+v", flags))
log.Debug("Using flags", "inputs", flags.inputs, "output", flags.output, "logLevel", flags.logLevel)
log.Debug(fmt.Sprintf("Merging sum file from %q into %q.", flags.inputs, flags.output))

View file

@ -42,14 +42,14 @@ func runSum(cmd *cobra.Command, _ []string) error {
return err
}
log := logger.NewTextLogger(flags.logLevel)
log.Debug(fmt.Sprintf("Parsed flags: %+v", flags))
log.Debug("Using flags", "imageRepoTag", flags.imageRepoTag, "ociPath", flags.ociPath)
registry, prefix, name, tag, err := splitRepoTag(flags.imageRepoTag)
if err != nil {
return fmt.Errorf("splitting repo tag: %w", err)
}
log.Debug(fmt.Sprintf("Generating sum file for OCI image %s.", name))
log.Debug(fmt.Sprintf("Generating sum file for OCI image %q.", name))
ociIndexPath := filepath.Join(flags.ociPath, "index.json")
index, err := os.Open(ociIndexPath)
@ -75,7 +75,7 @@ func runSum(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("extracting OCI image digest: %w", err)
}
log.Debug(fmt.Sprintf("OCI image digest: %s", digest))
log.Debug(fmt.Sprintf("OCI image digest: %q", digest))
refs := []sums.PinnedImageReference{
{