lib/splash/loggers/dual.rb in prometheus-splash-0.5.0 vs lib/splash/loggers/dual.rb in prometheus-splash-0.5.2

- old
+ new

@@ -1,12 +1,24 @@ module Splash module Loggers - class Dual < Splash::Loggers::LoggerTemplate + class Dual #< Splash::Loggers::LoggerTemplate + + include Splash::Config + LEVELS.each do |method| + define_method(method) do |message,session = ''| + self.log({ :level => method, :message => message, :session => session}) + end + end + ALIAS.keys.each do |method| + define_method(method) do |message,session = ''| + self.log({ :level => method, :message => message, :session => session}) + end + end def initialize super @log1 = Splash::Loggers::Cli::new @log2 = Splash::Loggers::Daemon::new @@ -14,9 +26,17 @@ def log(options) @log1.log options @log2.log options end + def level + @level + end + def level=(level) + @level = level + @log1.level=level + @log2.level=level + end end end end