Class MCollective::Logger::Base
In: lib/mcollective/logger/base.rb
Parent: Object

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

Methods

cycle_level   new   set_level  

Public Class methods

[Source]

    # File lib/mcollective/logger/base.rb, line 12
12:             def initialize
13:                 @known_levels = [:debug, :info, :warn, :error, :fatal]
14: 
15:                 # Sanity check the class that impliments the logging
16:                 @known_levels.each do |lvl|
17:                     raise "Logger class did not specify a map for #{lvl}" unless valid_levels.include?(lvl)
18:                 end
19:             end

Public Instance methods

Figures out the next level and sets it

[Source]

    # File lib/mcollective/logger/base.rb, line 22
22:             def cycle_level
23:                 lvl = get_next_level
24:                 set_level(lvl)
25: 
26:                 log(lvl, "", "Logging level is now #{lvl.to_s.upcase}")
27:             end

Sets a new level and record it in @active_level

[Source]

    # File lib/mcollective/logger/base.rb, line 30
30:             def set_level(level)
31:                 set_logging_level(level)
32:                 @active_level = level.to_sym
33:             end

[Validate]