Skip to content

Commit

Permalink
Logger can take in exceptions according to documentation so stringify…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Mogan committed Sep 3, 2019
1 parent 43f2b3a commit ff84c32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/raven/breadcrumbs/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def add_breadcrumb(severity, message = nil, progname = nil)

# some loggers will add leading/trailing space as they (incorrectly, mind you)
# think of logging as a shortcut to std{out,err}
message = message.strip
message = message.to_s.strip

last_crumb = Raven.breadcrumbs.peek
# try to avoid dupes from logger broadcasts
Expand Down
9 changes: 9 additions & 0 deletions spec/raven/logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,13 @@

expect(stringio.string).to end_with("FATAL -- sentry: ** [Raven] Oh noes!\n")
end

it "should allow exceptions to be logged" do
stringio = StringIO.new
log = Raven::Logger.new(stringio)

log.fatal(Exception.new("Oh exceptions"))

expect(stringio.string).to end_with("FATAL -- sentry: ** [Raven] Oh exceptions\n")
end
end

0 comments on commit ff84c32

Please sign in to comment.