X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=doc%2Fclasses%2FMCollective%2FLogger%2FSyslog_logger.html;fp=doc%2Fclasses%2FMCollective%2FLogger%2FSyslog_logger.html;h=3a57425ba36e1483ef73293d5010bdfe78896dbb;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=0000000000000000000000000000000000000000;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/MCollective/Logger/Syslog_logger.html b/doc/classes/MCollective/Logger/Syslog_logger.html new file mode 100644 index 0000000..3a57425 --- /dev/null +++ b/doc/classes/MCollective/Logger/Syslog_logger.html @@ -0,0 +1,278 @@ + + + + +
+Class | +MCollective::Logger::Syslog_logger | +
In: | +
+
+ lib/mcollective/logger/syslog_logger.rb
+
+ + |
+
Parent: | ++ + Base + + | +
+Implements a syslog based logger using the standard ruby syslog class +
+ ++ # File lib/mcollective/logger/syslog_logger.rb, line 42 +42: def log(level, from, msg) +43: Syslog.send(map_level(level), "#{from} #{msg}") +44: rescue +45: # if this fails we probably cant show the user output at all, +46: # STDERR it as last resort +47: STDERR.puts("#{level}: #{msg}") +48: end ++
+ # File lib/mcollective/logger/syslog_logger.rb, line 30 +30: def set_logging_level(level) +31: # noop +32: end ++
+ # File lib/mcollective/logger/syslog_logger.rb, line 9 + 9: def start +10: config = Config.instance +11: +12: facility = syslog_facility(config.logfacility) +13: level = config.loglevel.to_sym +14: +15: Syslog.close if Syslog.opened? +16: Syslog.open(File.basename($0), 3, facility) +17: +18: set_level(level) +19: end ++
+ # File lib/mcollective/logger/syslog_logger.rb, line 21 +21: def syslog_facility(facility) +22: begin +23: Syslog.const_get("LOG_#{facility.upcase}") +24: rescue NameError => e +25: STDERR.puts "Invalid syslog facility #{facility} supplied, reverting to USER" +26: Syslog::LOG_USER +27: end +28: end ++