class Opsmgr::Log
Public Class Methods
instance()
click to toggle source
# File lib/opsmgr/log.rb, line 28 def instance @instance || fail('Logging attempted without being configured first!') end
stdout_mode!()
click to toggle source
# File lib/opsmgr/log.rb, line 39 def stdout_mode! STDOUT.sync = true @instance = ::Logger.new(STDOUT) instance.sev_threshold = ::Logger.const_get(ENV.fetch('LOG_LEVEL', 'INFO')) end
test_mode!()
click to toggle source
# File lib/opsmgr/log.rb, line 32 def test_mode! log_path = '/tmp/opsmgr_test.log' File.open(log_path, 'w') {} # empty out the file in a cross-platform-safe way @instance = ::Logger.new(log_path, File::WRONLY | File::APPEND) instance.sev_threshold = ::Logger::DEBUG end