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
-
.log ⇒ Object
Creates a new logger instance a single time and set the log level.
Instance Method Summary collapse
Class Method Details
.log ⇒ Object
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 |