diff --git a/autoinstrument/init.go b/autoinstrument/init.go index f8d3cf52..725408ad 100644 --- a/autoinstrument/init.go +++ b/autoinstrument/init.go @@ -9,6 +9,7 @@ import ( "go.undefinedlabs.com/scopeagent" "go.undefinedlabs.com/scopeagent/agent" + "go.undefinedlabs.com/scopeagent/env" "go.undefinedlabs.com/scopeagent/instrumentation" scopegocheck "go.undefinedlabs.com/scopeagent/instrumentation/gocheck" scopetesting "go.undefinedlabs.com/scopeagent/instrumentation/testing" @@ -35,8 +36,10 @@ func init() { defer func() { logOnError(runPatch.Patch()) }() - scopetesting.PatchTestingLogger() - defer scopetesting.UnpatchTestingLogger() + if env.ScopeInstrumentationTestingLogger.Value { + scopetesting.PatchTestingLogger() + defer scopetesting.UnpatchTestingLogger() + } return scopeagent.Run(m, agent.WithGlobalPanicHandler()) }) logOnError(err) diff --git a/env/vars.go b/env/vars.go index c72b010f..376fad33 100644 --- a/env/vars.go +++ b/env/vars.go @@ -27,4 +27,5 @@ var ( ScopeRunnerIncludeBranches = newSliceEnvVar(nil, "SCOPE_RUNNER_INCLUDE_BRANCHES") ScopeRunnerExcludeBranches = newSliceEnvVar(nil, "SCOPE_RUNNER_EXCLUDE_BRANCHES") ScopeDependenciesIndirect = newBooleanEnvVar(false, "SCOPE_DEPENDENCIES_INDIRECT") + ScopeInstrumentationTestingLogger = newBooleanEnvVar(true, "`SCOPE_INSTRUMENTATION_TESTING_LOGGER`") )