mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 15:53:59 +00:00
Clean up logging (#3161)
- use `Err` method instead of format strings - use `Msg` if no format string is used
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user