Skip to content

Commit

Permalink
fix for nil messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tycooon committed Apr 16, 2024
1 parent 7638f89 commit cb8efe6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/umbrellio_utils/semantic_logger/tiny_json_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def log_to_message(log)
msg << "\n#{e.backtrace.join("\n")}" if e.backtrace
msg
else
log.message
log.message.to_s
end
end

Expand Down
18 changes: 9 additions & 9 deletions spec/umbrellio_utils/semantic_logger/tiny_json_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
let(:options) { Hash[message_size_limit: 8] }

it "truncates message" do
expect(result).to be_json_as(
severity: "DEBUG",
name: "SomeName",
thread_fingerprint: "85bb6139",
message: "Some ...",
time: "2007-01-01T00:00:00.000000000Z",
tags: [],
named_tags: {},
)
expect(result).to be_json_including(message: "Some ...")
end

context "with nil message" do
let(:log_message) { nil }

it "logs blank message" do
expect(result).to be_json_including(message: "")
end
end
end

Expand Down

0 comments on commit cb8efe6

Please sign in to comment.