class CheckerJobs::Notifiers::Logger
Public Class Methods
default_options()
click to toggle source
# File lib/checker_jobs/notifiers/logger.rb, line 20 def self.default_options { logdev: STDOUT, level: Logger::INFO, } end
new(check, count, _entries)
click to toggle source
Calls superclass method
CheckerJobs::Notifiers::Base::new
# File lib/checker_jobs/notifiers/logger.rb, line 6 def initialize(check, count, _entries) super @count = count raise CheckerJobs::InvalidNotifierOptions unless valid? @logger = Logger.new(logdev) @logger.level = level end
Public Instance Methods
notify()
click to toggle source
# File lib/checker_jobs/notifiers/logger.rb, line 16 def notify @logger.add(level, format, human_check_name) end
Private Instance Methods
format()
click to toggle source
override this
# File lib/checker_jobs/notifiers/logger.rb, line 30 def format "found #{@count} entries" end
level()
click to toggle source
# File lib/checker_jobs/notifiers/logger.rb, line 42 def level @level ||= @check.klass.notifier_options[:level] || notifier_options[:level] end
logdev()
click to toggle source
# File lib/checker_jobs/notifiers/logger.rb, line 46 def logdev @logdev ||= @check.klass.notifier_options[:logdev] || notifier_options[:logdev] end
valid?()
click to toggle source
# File lib/checker_jobs/notifiers/logger.rb, line 34 def valid? (logdev.is_a?(String) || logdev.is_a?(IO)) && [ Logger::UNKNOWN, Logger::FATAL, Logger::ERROR, Logger::WARN, Logger::INFO, Logger::DEBUG ].include?(level) end