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

- old
+ new

@@ -14,18 +14,26 @@ @stream.sync = true end def log(options) + pid = Process.pid.to_s + date = DateTime.now.to_s level = (ALIAS.keys.include? options[:level])? ALIAS[options[:level]] : options[:level] if @active_levels.include? level then - @stream.puts "#{alt(options[:level])} #{options[:message]}" + unless options[:session].empty? then + @stream.puts "[#{date}] (#{pid}) (#{options[:session]}) #{alt(options[:level])} : #{options[:message]}" + else + @stream.puts "[#{date}] (#{pid}) #{alt(options[:level])} : #{options[:message]}" + end end end def close @stream.close end + + end end end