module Squash::Ruby
Public Class Methods
failsafe_log(tag, message)
click to toggle source
@private
# File lib/squash/rails.rb, line 32 def self.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
Private Class Methods
client_name()
click to toggle source
# File lib/squash/rails.rb, line 46 def self.client_name() 'rails' end
exception_info_hash(exception, *other_args)
Also aliased as: exception_info_hash_without_rails
Alias for: exception_info_hash_with_rails
exception_info_hash_with_rails(exception, *other_args)
click to toggle source
Unwrap ActiveRecord::StatementInvalid, since it's “special”
# File lib/squash/rails.rb, line 49 def self.exception_info_hash_with_rails(exception, *other_args) hsh = exception_info_hash_without_rails(exception, *other_args) if defined?(ActiveRecord::StatementInvalid) && exception.kind_of?(ActiveRecord::StatementInvalid) if hsh['message'] =~ /^([A-Za-z0-9:_]+?): / hsh['message'].sub! /^([A-Za-z0-9:_]+?): /, '' hsh['class_name'] = $1 end end hsh end
Also aliased as: exception_info_hash