Class: Failsafe::Backends::File
- Inherits:
-
Base
- Object
- Base
- Failsafe::Backends::File
show all
- Defined in:
- lib/failsafe/backends/file.rb
Overview
File failure backend. Writes exception backtraces to a logfile.
Instance Attribute Summary
Attributes inherited from Base
#exception
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Class Method Details
15
16
17
|
# File 'lib/failsafe/backends/file.rb', line 15
def self.configure
yield(self)
end
|
.log_file_path ⇒ Object
11
12
13
|
# File 'lib/failsafe/backends/file.rb', line 11
def self.log_file_path
@log_file_path || ::File.join(Rails.root, 'log', 'failsafe_errors.log')
end
|
.log_file_path=(log_file_path) ⇒ Object
6
7
8
9
|
# File 'lib/failsafe/backends/file.rb', line 6
def self.log_file_path=(log_file_path)
@logger = nil
@log_file_path = log_file_path
end
|
.logger ⇒ Object
19
20
21
|
# File 'lib/failsafe/backends/file.rb', line 19
def self.logger
@logger ||= ::Logger.new(log_file_path).tap { |l| l.formatter = Logger::Formatter.new }
end
|
Instance Method Details
#save ⇒ Object
23
24
25
26
27
28
|
# File 'lib/failsafe/backends/file.rb', line 23
def save
msg = []
msg << exception.message
msg << exception.backtrace.join("\n")
self.class.logger.error(msg.join)
end
|