diff --git a/acceptance/bundle/templates/dbt-sql/output.txt b/acceptance/bundle/templates/dbt-sql/output.txt index 972c7e1529..efd8be8157 100644 --- a/acceptance/bundle/templates/dbt-sql/output.txt +++ b/acceptance/bundle/templates/dbt-sql/output.txt @@ -22,6 +22,7 @@ Workspace: Validation OK! >>> $CLI bundle validate -t prod +11:31:28 WARN target with 'mode: production' should specify an explicit 'targets.prod.git' configuration pid=20104 mutator=initialize mutator=seq mutator=ProcessTargetMode Name: my_dbt_sql Target: prod Workspace: diff --git a/acceptance/bundle/templates/default-python/output.txt b/acceptance/bundle/templates/default-python/output.txt index 5493ac2cf7..6db329b5b9 100644 --- a/acceptance/bundle/templates/default-python/output.txt +++ b/acceptance/bundle/templates/default-python/output.txt @@ -20,6 +20,7 @@ Workspace: Validation OK! >>> $CLI bundle validate -t prod +11:31:29 WARN target with 'mode: production' should specify an explicit 'targets.prod.git' configuration pid=20387 mutator=initialize mutator=seq mutator=ProcessTargetMode Name: my_default_python Target: prod Workspace: diff --git a/acceptance/bundle/templates/default-sql/output.txt b/acceptance/bundle/templates/default-sql/output.txt index fe01390931..b4fd270af8 100644 --- a/acceptance/bundle/templates/default-sql/output.txt +++ b/acceptance/bundle/templates/default-sql/output.txt @@ -22,6 +22,7 @@ Workspace: Validation OK! >>> $CLI bundle validate -t prod +11:31:29 WARN target with 'mode: production' should specify an explicit 'targets.prod.git' configuration pid=20374 mutator=initialize mutator=seq mutator=ProcessTargetMode Name: my_default_sql Target: prod Workspace: diff --git a/bundle/mutator.go b/bundle/mutator.go index 6c9968aacd..462d53d3f9 100644 --- a/bundle/mutator.go +++ b/bundle/mutator.go @@ -35,17 +35,7 @@ func Apply(ctx context.Context, b *Bundle, m Mutator) diag.Diagnostics { } }() - diags := m.Apply(ctx, b) - - // Log error in diagnostics if any. - // Note: errors should be logged when constructing them - // such that they are not logged multiple times. - // If this is done, we can omit this block. - if err := diags.Error(); err != nil { - log.Errorf(ctx, "Error: %s", err) - } - - return diags + return m.Apply(ctx, b) } type funcMutator struct { diff --git a/bundle/mutator_read_only.go b/bundle/mutator_read_only.go index ee4e36e0fa..777198f13e 100644 --- a/bundle/mutator_read_only.go +++ b/bundle/mutator_read_only.go @@ -20,10 +20,5 @@ func ApplyReadOnly(ctx context.Context, rb ReadOnlyBundle, m ReadOnlyMutator) di ctx = log.NewContext(ctx, log.GetLogger(ctx).With("mutator (read-only)", m.Name())) log.Debugf(ctx, "ApplyReadOnly") - diags := m.Apply(ctx, rb) - if err := diags.Error(); err != nil { - log.Errorf(ctx, "Error: %s", err) - } - - return diags + return m.Apply(ctx, rb) } diff --git a/cmd/root/root.go b/cmd/root/root.go index 3b37d01769..4d0d425624 100644 --- a/cmd/root/root.go +++ b/cmd/root/root.go @@ -114,10 +114,15 @@ func Execute(ctx context.Context, cmd *cobra.Command) error { if err == nil { logger.Info("completed execution", slog.String("exit_code", "0")) + } else if errors.Is(err, ErrAlreadyPrinted) { + logger.Debug("failed execution", + slog.String("exit_code", "1"), + ) } else { logger.Error("failed execution", slog.String("exit_code", "1"), - slog.String("error", err.Error())) + slog.String("error", err.Error()), + ) } } diff --git a/libs/flags/log_level_flag.go b/libs/flags/log_level_flag.go index 836d84b700..82e2abc4c3 100644 --- a/libs/flags/log_level_flag.go +++ b/libs/flags/log_level_flag.go @@ -25,7 +25,7 @@ type LogLevelFlag struct { func NewLogLevelFlag() LogLevelFlag { return LogLevelFlag{ - l: log.LevelDisabled, + l: log.LevelWarn, } }