Clean up logging (#3161)

- use `Err` method instead of format strings
- use `Msg` if no format string is used
This commit is contained in:
qwerty287
2024-01-10 20:57:12 +01:00
committed by GitHub
parent 12c40eb957
commit 00df53e941
20 changed files with 47 additions and 47 deletions

View File

@@ -99,13 +99,13 @@ func configFromCliContext(ctx context.Context) (*config, error) {
// Unmarshal label and annotation settings here to ensure they're valid on startup
if labels := c.String("backend-k8s-pod-labels"); labels != "" {
if err := yaml.Unmarshal([]byte(labels), &config.PodLabels); err != nil {
log.Error().Msgf("could not unmarshal pod labels '%s': %s", c.String("backend-k8s-pod-labels"), err)
log.Error().Err(err).Msgf("could not unmarshal pod labels '%s'", c.String("backend-k8s-pod-labels"))
return nil, err
}
}
if annotations := c.String("backend-k8s-pod-annotations"); annotations != "" {
if err := yaml.Unmarshal([]byte(c.String("backend-k8s-pod-annotations")), &config.PodAnnotations); err != nil {
log.Error().Msgf("could not unmarshal pod annotations '%s': %s", c.String("backend-k8s-pod-annotations"), err)
log.Error().Err(err).Msgf("could not unmarshal pod annotations '%s'", c.String("backend-k8s-pod-annotations"))
return nil, err
}
}

View File

@@ -258,7 +258,7 @@ func resourceList(resources map[string]string) (v1.ResourceList, error) {
resName := v1.ResourceName(key)
resVal, err := resource.ParseQuantity(val)
if err != nil {
return nil, fmt.Errorf("resource request '%v' quantity '%v': %w", key, val, err)
return nil, fmt.Errorf("resource request '%s' quantity '%s': %w", key, val, err)
}
requestResources[resName] = resVal
}

View File

@@ -235,7 +235,7 @@ func (e *local) DestroyStep(_ context.Context, _ *types.Step, _ string) error {
// DestroyWorkflow the pipeline environment.
func (e *local) DestroyWorkflow(_ context.Context, _ *types.Config, taskUUID string) error {
log.Trace().Str("taskUUID", taskUUID).Msgf("delete workflow environment")
log.Trace().Str("taskUUID", taskUUID).Msg("delete workflow environment")
state, err := e.getState(taskUUID)
if err != nil {