X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=doc%2Fclasses%2FMCollective%2FLogger%2FBase.html;fp=doc%2Fclasses%2FMCollective%2FLogger%2FBase.html;h=cb3aa66ee06df48330cf04f3d4eaa821d730ba56;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=0000000000000000000000000000000000000000;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/MCollective/Logger/Base.html b/doc/classes/MCollective/Logger/Base.html new file mode 100644 index 0000000..cb3aa66 --- /dev/null +++ b/doc/classes/MCollective/Logger/Base.html @@ -0,0 +1,264 @@ + + + + + + Class: MCollective::Logger::Base + + + + + + + + + + +
+ + + + + + + + + + + + + + +
ClassMCollective::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   + should_log?   +
+
+ +
+ + + + +
+ + + + + +
+

Attributes

+ +
+ + + + + + +
active_level [R] 
+
+
+ + + + +
+

Public Class methods

+ +
+ + + + +
+

[Source]

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

Public Instance methods

+ +
+ + + + +
+

+Figures out the next level and sets it +

+

[Source]

+
+
+    # File lib/mcollective/logger/base.rb, line 28
+28:       def cycle_level
+29:         lvl = get_next_level
+30:         set_level(lvl)
+31: 
+32:         log(lvl, "", "Logging level is now #{lvl.to_s.upcase}")
+33:       end
+
+
+
+
+ +
+ + + + +
+

+Sets a new level and record it in +@active_level +

+

[Source]

+
+
+    # File lib/mcollective/logger/base.rb, line 36
+36:       def set_level(level)
+37:         set_logging_level(level)
+38:         @active_level = level.to_sym
+39:       end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+    # File lib/mcollective/logger/base.rb, line 23
+23:       def should_log?(level)
+24:         @known_levels.index(level) >= @known_levels.index(@active_level)
+25:       end
+
+
+
+
+ + +
+ + +
+ + +
+

[Validate]

+
+ + + \ No newline at end of file