Skip to content

Commit

Permalink
Fix a failed test of ConsoleAdapter (#4477)
Browse files Browse the repository at this point in the history
Follow the change of the log format as of console v1.24.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
  • Loading branch information
ashie committed Apr 30, 2024
1 parent 2faeb04 commit a226e28
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/log/test_console_adapter.rb
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 a226e28

Please sign in to comment.