lib/splash/loggers.rb in prometheus-splash-0.4.5 vs lib/splash/loggers.rb in prometheus-splash-0.5.0

- old
+ new

@@ -16,11 +16,15 @@ # rescue # splash_exit case: :configuration_error, more: "Logger specified inexistant : #{logger}" # end end + def get_session + return "#{Time.now.to_i.to_s}#{rand(999)}" + end + def change_logger(options = {}) options[:force] = true get_logger(options) end @@ -32,16 +36,16 @@ LEVELS = [:debug, :warn, :info, :result, :fatal, :unknown] ALIAS = {:flat => :info, :item => :info, :ok => :info, :ko => :info, :trigger => :info, :schedule => :info, :arrow => :info, :send => :info, :receive => :info, :error => :result, :success => :result } LEVELS.each do |method| - define_method(method) do |message| - self.log({ :level => method, :message => message}) + 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| - self.log({ :level => method, :message => message}) + define_method(method) do |message,session = ''| + self.log({ :level => method, :message => message, :session => session}) end end def initialize self.level = get_config.loggers[:level]