Module: Sensu::Plugins::Utils::Log

Included in:
Events::Dispatcher, Prometheus::Checks::Runner, Prometheus::Client, Prometheus::Metrics
Defined in:
lib/sensu/plugins/utils/log.rb

Overview

Helper class to handle application logging. To be included in other classes and referenced by ‘log`.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.logObject

Creates a new logger instance a single time and set the log level. The level is determined by ‘PROM_DEBUG’ environment variable, when set the logger will use ‘0` (DEEBUG) otherwise `1` (INFO).



16
17
18
19
20
# File 'lib/sensu/plugins/utils/log.rb', line 16

def self.log
  @log ||= Logger.new(STDOUT)
  @log.level = 1 if @log && !ENV.key?('PROM_DEBUG')
  @log
end

Instance Method Details

#logObject



9
10
11
# File 'lib/sensu/plugins/utils/log.rb', line 9

def log
  Log.log
end