Class: Opsmgr::Log
- Inherits:
-
Object
- Object
- Opsmgr::Log
- Defined in:
- lib/opsmgr/log.rb
Class Method Summary collapse
Class Method Details
.instance ⇒ Object
28 29 30 |
# File 'lib/opsmgr/log.rb', line 28 def instance @instance || fail('Logging attempted without being configured first!') end |
.stdout_mode! ⇒ Object
39 40 41 42 43 |
# 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! ⇒ Object
32 33 34 35 36 37 |
# 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 |