Skip to content

Commit a8135b3

Browse files
halkeyeHazAT
authored andcommitted
Logger can take in exceptions according to documentation so stringify first (#914)
1 parent 43f2b3a commit a8135b3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/raven/breadcrumbs/logger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def add_breadcrumb(severity, message = nil, progname = nil)
3636

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

4141
last_crumb = Raven.breadcrumbs.peek
4242
# try to avoid dupes from logger broadcasts

spec/raven/logger_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,13 @@
99

1010
expect(stringio.string).to end_with("FATAL -- sentry: ** [Raven] Oh noes!\n")
1111
end
12+
13+
it "should allow exceptions to be logged" do
14+
stringio = StringIO.new
15+
log = Raven::Logger.new(stringio)
16+
17+
log.fatal(Exception.new("Oh exceptions"))
18+
19+
expect(stringio.string).to end_with("FATAL -- sentry: ** [Raven] Oh exceptions\n")
20+
end
1221
end

0 commit comments

Comments
 (0)