lib/oboe/loading.rb in oboe-1.4.2.2 vs lib/oboe/loading.rb in oboe-2.1.1
- old
+ new
@@ -22,10 +22,15 @@
end
end
end
module Loading
+ def self.setup_logger
+ if defined?(::Rails) and ::Rails.logger
+ Oboe.logger = ::Rails.logger
+ end
+ end
def self.load_access_key
unless Oboe::Config.access_key
config_file = '/etc/tracelytics.conf'
return unless File.exists?(config_file)
@@ -38,11 +43,11 @@
Oboe::Config[:rum_id] = Oboe::Util::Base64URL.encode(Digest::SHA1.digest("RUM" + Oboe::Config[:access_key]))
break
end
end
rescue
- puts "Having trouble parsing #{config_file}..."
+ Oboe.logger.error "Having trouble parsing #{config_file}..."
end
end
end
def self.require_api
@@ -55,11 +60,11 @@
require 'oboe/api'
begin
Oboe::API.extend_with_tracing
rescue LoadError => e
- puts "[oboe/error] Couldn't load oboe api."
+ Oboe.logger.fatal "[oboe/error] Couldn't load oboe api."
end
require 'oboe/config'
end
@@ -67,10 +72,10 @@
pattern = File.join(File.dirname(__FILE__), 'frameworks/*/', '*.rb')
Dir.glob(pattern) do |f|
begin
require f
rescue => e
- $stderr.puts "[oboe/loading] Error loading framework file '#{f}' : #{e}"
+ Oboe.logger.error "[oboe/loading] Error loading framework file '#{f}' : #{e}"
end
end
end
end
end