Updated

app/lib / audit_logger.rb

A
23 lines of codes
3 methods
5.2 complexity/method
5 churn
15.71 complexity
0 duplications
class AuditLogger < Logger
  1. AuditLogger has no descriptive comment
def initialize(logdev, error_class, shift_age = 0, shift_size = 1048576) super(logdev, shift_age, shift_size) @level = ['test', 'cucumber'].include?(Rails.env) ? WARN : INFO @error_class = error_class end def format_message(severity, timestamp, progname, msg)
  1. AuditLogger#format_message has 4 parameters
  2. AuditLogger#format_message has unused parameter 'progname'
puts "#{severity} #{msg}" if self.level == Logger::DEBUG "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" end def error(msg, exception = nil) if exception.nil?
  1. AuditLogger#error performs a nil-check
exception = RuntimeError.new("#{@error_class}: #{msg}") exception.set_backtrace msg end Appsignal.send_exception(exception) add(ERROR, nil, msg) end end