Class: Log::Utils
- Inherits:
-
Object
- Object
- Log::Utils
- Defined in:
- lib/log/utils.rb
Class Method Summary collapse
Class Method Details
.prepare_message(message, simple = false) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/log/utils.rb', line 16 def self.(, simple=false) if .kind_of? Exception if simple return . else return pretty_print_exception() end end return .to_s end |
.pretty_print_exception(exception) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/log/utils.rb', line 3 def self.pretty_print_exception(exception) raise ArgumentError.new("must pass exception") if (!exception.kind_of? Exception) # Code taken from C:\Ruby192\lib\ruby\gems\1.9.1\gems\actionpack-3.0.3\lib\action_dispatch\middleware\show_exceptions.rb = "\n#{exception.class} (#{exception.}):\n" << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code) << " " << (defined?(Rails) && Rails.respond_to?(:backtrace_cleaner) && exception.backtrace ? Rails.backtrace_cleaner.clean(exception.backtrace) : exception.backtrace).try(:join, "\n ").to_s return end |