Skip to content

Commit

Permalink
negate boolean polarity of flag
Browse files Browse the repository at this point in the history
Signed-off-by: Max Fisher <[email protected]>
  • Loading branch information
maxfisher-g committed Oct 19, 2023
1 parent 7ad2901 commit 70e0d78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions internal/featureflags/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ var (
// methods and classes are logged to a file.
CodeExecution = new("CodeExecution", false)

// DisableStraceDebugLogging prevents debug logging of strace parsing during
// dynamic analysis. Since the strace parsing produces a large amount of debug
// output, it can be useful to disable this when the information is not needed.
DisableStraceDebugLogging = new("DisableStraceDebugLogging", false)
// StraceDebugLogging enables verbose logging of strace parsing during dynamic analysis.
// It is useful for debugging strace parsing code but can be safely disabled otherwise.
StraceDebugLogging = new("StraceDebugLogging", true)
)
4 changes: 2 additions & 2 deletions internal/worker/rundynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ func RunDynamicAnalysis(ctx context.Context, pkg *pkgmanager.Pkg, sbOpts []sandb
}

// getStraceLogger returns an slog.Logger instance for the strace parsing functions.
// If featureflags.DisableStraceDebugLogging is enabled, the logger will discard any
// If featureflags.StraceDebugLogging is disabled, the logger will discard any
// log messages with level below slog.LevelInfo (i.e. LevelDebug). Otherwise, the
// default logging method is used.
func getStraceLogger(ctx context.Context) *slog.Logger {
logger := slog.Default()
if featureflags.DisableStraceDebugLogging.Enabled() {
if !featureflags.StraceDebugLogging.Enabled() {
infoOnly := &slog.HandlerOptions{Level: slog.LevelInfo}
logger = slog.New(slog.NewTextHandler(os.Stderr, infoOnly))
}
Expand Down

0 comments on commit 70e0d78

Please sign in to comment.