-
Notifications
You must be signed in to change notification settings - Fork 390
/
rails.rb
32 lines (29 loc) · 915 Bytes
/
rails.rb
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
require 'airbrake/rails/railtie'
module Airbrake
# Rails namespace holds all Rails-related functionality.
module Rails
def self.logger
if ENV['RAILS_LOG_TO_STDOUT'].present?
Logger.new(STDOUT, level: ::Rails.logger.level)
else
Logger.new(
::Rails.root.join('log', 'airbrake.log'),
# Rails.logger is not set in some Rake tasks such as
# 'airbrake:deploy'. In this case we use a sensible fallback.
level: (::Rails.logger ? ::Rails.logger.level : Logger::ERROR)
)
end
end
end
end
if defined?(ActionController::Metal)
require 'airbrake/rails/action_controller'
module ActionController
# Adds support for Rails API/Metal for Rails < 5. Rails 5+ uses standard
# hooks.
# @see https://github.com/airbrake/airbrake/issues/821
class Metal
include Airbrake::Rails::ActionController
end
end
end