test/test_helper.rb in logster-0.0.13 vs test/test_helper.rb in logster-0.1.0
- old
+ new
@@ -10,9 +10,30 @@
attr_accessor :reported
def initialize
@reported = []
end
- def report(*args)
- @reported << args
+ def report(severity, progname, message, opts = nil)
+ opts ||= {}
+ env = opts[:env]
+ backtrace = opts[:backtrace]
+ if env && !backtrace
+ backtrace = env[:backtrace]
+ end
+
+ message = Logster::Message.new(severity, progname, message)
+
+ if backtrace
+ message.backtrace = backtrace
+ else
+ message.backtrace = caller.join("\n")
+ end
+
+ if env
+ message.populate_from_env(env)
+ end
+
+ @reported << message
+
+ message
end
end