-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.rb
More file actions
38 lines (36 loc) · 1.61 KB
/
init.rb
File metadata and controls
38 lines (36 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'loggr-rb'
# If old plugin still installed then we don't want to install this one.
# In production environments we should continue to work as before, but in development/test we should
# advise how to correct the problem and exit
if (defined?(Loggr::VERSION::STRING) rescue nil) && %w(development test).include?(RAILS_ENV)
message = %Q(
***********************************************************************
You seem to still have an old version of the Loggr plugin installed.
Remove it from /vendor/plugins and try again.
***********************************************************************
)
puts message
exit -1
else
begin
if (Rails::VERSION::MAJOR < 3)
Loggr::Config.load(File.join(RAILS_ROOT, "/config/loggr.yml"))
if Loggr::Config.should_send_to_api?
Loggr.logger.info("Loading Loggr #{Loggr::VERSION} for #{Rails::VERSION::STRING}")
require File.join('loggr-rb', 'integration', 'rails')
require File.join('loggr-rb', 'integration', 'dj') if defined?(Delayed::Job)
end
else
Loggr::Config.load(File.join(Rails.root, "/config/loggr.yml"))
if Loggr::Config.should_send_to_api?
Loggr.logger.info("Loading Loggr #{Loggr::VERSION} for #{Rails::VERSION::STRING}")
Rails.configuration.middleware.use "Rack::RailsLoggr"
require File.join('loggr-rb', 'integration', 'dj') if defined?(Delayed::Job)
end
end
rescue => e
STDERR.puts "Problem starting Loggr Plugin. Your app will run as normal. #{e.message}"
Loggr.logger.error(e.message)
Loggr.logger.error(e.backtrace)
end
end