|
1class AuditLogger < Logger
|
|
|
|
3 def initialize(logdev, error_class, shift_age = 0, shift_size = 1048576)
|
|
4 super(logdev, shift_age, shift_size)
|
|
5 @level = ['test', 'cucumber'].include?(Rails.env) ? WARN : INFO
|
|
6 @error_class = error_class
|
|
|
|
|
- LongParameterList - has 4 parameters » reek
- UnusedParameters - has unused parameter 'progname' » reek
- Complexity 2 » saikuro
|
9 def format_message(severity, timestamp, progname, msg)
|
|
10 puts "#{severity} #{msg}" if self.level == Logger::DEBUG
|
|
11 "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
|
|
|
|
|
- NilCheck - performs a nil-check » reek
- Complexity 2 » saikuro
|
14 def error(msg, exception = nil)
|
|
|
|
16 exception = RuntimeError.new("#{@error_class}: #{msg}")
|
|
17 exception.set_backtrace msg
|
|
|
|
19 Appsignal.send_exception(exception)
|
|
|
|
|
|
|
|
|