lib/contrast/agent.rb in contrast-agent-6.9.0 vs lib/contrast/agent.rb in contrast-agent-6.10.0
- old
+ new
@@ -53,10 +53,11 @@
FINDINGS = Contrast::Utils::Findings.new
EXPLOITS = Contrast::Agent::Protect::ExploitableCollection.new
# @return [Contrast::Framework::Manager]
def self.framework_manager
+ reinitialize_with_log
@_framework_manager ||= Contrast::Framework::Manager.new
end
# @return [nil, Contrast::Utils::HeapDumpUtil]
def self.heapdump_util
@@ -79,9 +80,20 @@
end
# @return [Contrast::Agent::ThreadWatcher]
def self.thread_watcher
@_thread_watcher ||= Contrast::Agent::ThreadWatcher.new
+ end
+
+ # Apparently by some unknown reason - if we have already some instance for the AgentLib - we can set the
+ # logger with options. That's why in rspec it started passing - because when we set the const in
+ # protect_spec_helper in the with AgentLib context - we've already set the AGENT_LIB constant.
+ #
+ # So that leads to this methods logic here, which somehow works
+ def self.reinitialize_with_log
+ return if Contrast::AGENT_LIB.enable_log
+
+ Contrast.cs__const_set(:AGENT_LIB, Contrast::AgentLib::Interface.new(true, 2, nil))
end
end
end
require 'contrast/utils/resource_loader'