lib/rorvswild.rb in rorvswild-1.5.0 vs lib/rorvswild.rb in rorvswild-1.5.1
- old
+ new
@@ -18,11 +18,11 @@
def self.agent
@agent
end
def self.logger
- @logger ||= Logger.new(STDOUT)
+ @logger ||= initialize_logger
end
def self.measure_code(code)
agent ? agent.measure_code(code) : eval(code)
end
@@ -37,14 +37,18 @@
def self.record_error(exception, extra_details = nil)
agent.record_error(exception, extra_details) if agent
end
- def self.initialize_logger(destination)
- if destination
+ def self.initialize_logger(destination = nil)
+ if destination.is_a?(Logger)
+ destination
+ elsif destination
Logger.new(destination)
elsif defined?(Rails)
- Logger.new(Rails.root + "log/rorvswild.log")
+ Rails.logger
+ else
+ Logger.new(STDOUT)
end
end
def self.clock_milliseconds
Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)