Created
May 12, 2017 21:23
-
-
Save longlostnick/91b19ac9ed0e4c47e80dec40d2d7d35d to your computer and use it in GitHub Desktop.
Ruby logger helper method for friendly logging of exceptions with stack trace.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Logger | |
def exception(e, level=:error) | |
self.send level, "#{e.inspect} #{e.message}" | |
self.send level, " #{e.backtrace.first(25).join("\n ")}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment