@@ -32,7 +32,7 @@ type Statement[K any] struct {
32
32
func (s * Statement [K ]) Execute (ctx context.Context , tCtx K ) (any , bool , error ) {
33
33
condition , err := s .condition .Eval (ctx , tCtx )
34
34
defer func () {
35
- if s .telemetrySettings .Logger != nil {
35
+ if s .telemetrySettings .Logger . Core (). Enabled ( zap . DebugLevel ) {
36
36
s .telemetrySettings .Logger .Debug ("TransformContext after statement execution" , zap .String ("statement" , s .origText ), zap .Bool ("condition matched" , condition ), zap .Any ("TransformContext" , tCtx ))
37
37
}
38
38
}()
@@ -381,7 +381,9 @@ func NewStatementSequence[K any](statements []*Statement[K], telemetrySettings c
381
381
// When the ErrorMode of the StatementSequence is `ignore`, errors are logged and execution continues to the next statement.
382
382
// When the ErrorMode of the StatementSequence is `silent`, errors are not logged and execution continues to the next statement.
383
383
func (s * StatementSequence [K ]) Execute (ctx context.Context , tCtx K ) error {
384
- s .telemetrySettings .Logger .Debug ("initial TransformContext before executing StatementSequence" , zap .Any ("TransformContext" , tCtx ))
384
+ if s .telemetrySettings .Logger .Core ().Enabled (zap .DebugLevel ) {
385
+ s .telemetrySettings .Logger .Debug ("initial TransformContext before executing StatementSequence" , zap .Any ("TransformContext" , tCtx ))
386
+ }
385
387
for _ , statement := range s .statements {
386
388
_ , _ , err := statement .Execute (ctx , tCtx )
387
389
if err != nil {
@@ -454,7 +456,9 @@ func (c *ConditionSequence[K]) Eval(ctx context.Context, tCtx K) (bool, error) {
454
456
var atLeastOneMatch bool
455
457
for _ , condition := range c .conditions {
456
458
match , err := condition .Eval (ctx , tCtx )
457
- c .telemetrySettings .Logger .Debug ("condition evaluation result" , zap .String ("condition" , condition .origText ), zap .Bool ("match" , match ), zap .Any ("TransformContext" , tCtx ))
459
+ if c .telemetrySettings .Logger .Core ().Enabled (zap .DebugLevel ) {
460
+ c .telemetrySettings .Logger .Debug ("condition evaluation result" , zap .String ("condition" , condition .origText ), zap .Bool ("match" , match ), zap .Any ("TransformContext" , tCtx ))
461
+ }
458
462
if err != nil {
459
463
if c .errorMode == PropagateError {
460
464
err = fmt .Errorf ("failed to eval condition: %v, %w" , condition .origText , err )
0 commit comments