Class: Vara::Log
- Inherits:
-
Object
- Object
- Vara::Log
- Defined in:
- lib/vara/log.rb
Class Method Summary collapse
Class Method Details
.instance ⇒ Object
32 33 34 |
# File 'lib/vara/log.rb', line 32 def instance @instance || raise('Logging attempted without being configured first!') end |
.stdout_mode! ⇒ Object
43 44 45 46 47 |
# File 'lib/vara/log.rb', line 43 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
36 37 38 39 40 41 |
# File 'lib/vara/log.rb', line 36 def test_mode! log_path = '/tmp/vara_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 |