3 class Logger < ::Logger
15 @capture = StringIO.new
27 def log(watch, level, text)
28 # initialize watch log if necessary
29 self.logs[watch.name] ||= Timeline.new(God::LOG_BUFFER_SIZE_DEFAULT) if watch
31 # push onto capture and timeline for the given watch
33 templog = ::Logger.new(buf)
34 templog.send(level, text)
36 @capture.puts(buf.string) if @capture
37 self.logs[watch.name] << [Time.now, buf.string] if watch
41 # send to regular logger
42 self.send(level, text)
45 def watch_log_since(watch_name, since)
46 # initialize watch log if necessary
47 self.logs[watch_name] ||= Timeline.new(God::LOG_BUFFER_SIZE_DEFAULT)
49 # get and join lines since given time
51 self.logs[watch_name].select do |x|