fix(logging): allow sending an exception to the logger

Several places in the Rails codebase the logger is passed an exception
instead of a string, so we should handle this. This implementation
mimics the output from log_exception when being passed an exception.