Module: Squash::Ruby

Defined in:
lib/exception_notifier/squash_ruby/rails.rb,
lib/exception_notifier/squash_ruby/ruby.rb

Overview

Extend SquashNotifier with Rails support

Class Method Summary collapse

Class Method Details

.client_nameObject



12
13
14
# File 'lib/exception_notifier/squash_ruby/rails.rb', line 12

def client_name
  'squash-notifier-rails'
end

.failsafe_log(tag, message) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/exception_notifier/squash_ruby/rails.rb', line 16

def failsafe_log(tag, message)
  logger = Rails.respond_to?(:logger) ? Rails.logger : RAILS_DEFAULT_LOGGER
  if (logger.respond_to?(:tagged))
    logger.tagged(tag) { logger.error message }
  else
    logger.error "[#{tag}]\t#{message}"
  end
rescue Object => err
  $stderr.puts "Couldn't write to failsafe log (#{err.to_s}); writing to stderr instead."
  $stderr.puts "#{Time.now.to_s}\t[#{tag}]\t#{message}"
end