A base class for logging providers.
Logging providers should provide the following:
* start - all you need to do to setup your logging * set_logging_level - set your logging to :info, :warn, etc * valid_levels - a hash of maps from :info to your internal level name * log - what needs to be done to log a specific message
# File lib/mcollective/logger/base.rb, line 14 def initialize @known_levels = [:debug, :info, :warn, :error, :fatal] # Sanity check the class that impliments the logging @known_levels.each do |lvl| raise "Logger class did not specify a map for #{lvl}" unless valid_levels.include?(lvl) end end
Figures out the next level and sets it
# File lib/mcollective/logger/base.rb, line 24 def cycle_level lvl = get_next_level set_level(lvl) log(lvl, "", "Logging level is now #{lvl.to_s.upcase}") end
Sets a new level and record it in @active_level
# File lib/mcollective/logger/base.rb, line 32 def set_level(level) set_logging_level(level) @active_level = level.to_sym end