Skip to content

Commit

Permalink
Fix a failed test of ConsoleAdapter (#4477)
Browse files Browse the repository at this point in the history
Backported from a226e28.

---

Follow the change of the log format as of console v1.24.

Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie authored and daipom committed May 7, 2024
1 parent 44d132c commit 6ce7d1e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/log/test_console_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,18 @@ def test_args(level)
fatal: :fatal)
def test_options(level)
@console_logger.send(level, "subject", kwarg1: "opt1", kwarg2: "opt2")
lines = @logdev.logs[0].split("\n")
args = JSON.load(lines[1..].collect { |str| str.sub(/\s+\|/, "") }.join("\n"));
assert_equal([
"#{@timestamp_str} [#{level}]: 0.0s: subject\n" +
" | {\"kwarg1\":\"opt1\",\"kwarg2\":\"opt2\"}\n"
1,
"#{@timestamp_str} [#{level}]: 0.0s: subject",
{ "kwarg1" => "opt1", "kwarg2" => "opt2" }
],
@logdev.logs)
[
@logdev.logs.size,
lines[0],
args
])
end

data(debug: :debug,
Expand Down

0 comments on commit 6ce7d1e

Please sign in to comment.