Skip to content

Commit

Permalink
enable trace logging only if logrus.TraceLevel is TRACE (#1273)
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Tingaikin <denis.tingajkin@xored.com>
  • Loading branch information
denis-tingaikin committed Apr 29, 2022
1 parent ca9d98e commit 2812c2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/tools/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ package log
import (
"context"
"sync/atomic"

"github.com/sirupsen/logrus"
)

type contextKeyType string
Expand Down Expand Up @@ -77,7 +79,8 @@ func WithLog(ctx context.Context, log ...Logger) context.Context {

// IsTracingEnabled - checks if it is allowed to use traces
func IsTracingEnabled() bool {
return atomic.LoadInt32(&isTracingEnabled) != 0
// TODO: Rework this within https://github.com/networkservicemesh/sdk/issues/1272
return atomic.LoadInt32(&isTracingEnabled) != 0 && logrus.GetLevel() == logrus.TraceLevel
}

// EnableTracing - enable/disable traces
Expand Down

0 comments on commit 2812c2a

Please sign in to comment.