Skip to content

Commit dadb797

Browse files
committed
Stop unpacking {state, data}
1 parent d6fc706 commit dadb797

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

lib/logger/lib/logger/translator.ex

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,19 +324,10 @@ defmodule Logger.Translator do
324324
["\nPostponed: #{inspect(postponed, inspect_opts)}"]
325325

326326
if min_level == :debug do
327-
state_info =
328-
case state do
329-
{state, data} ->
330-
["\nState: ", inspect(state, inspect_opts), "\nData: ", inspect(data, inspect_opts)]
331-
332-
# Might be formatted by c:format_status/2 and not be a pair
333-
state ->
334-
["\nState: ", inspect(state, inspect_opts)]
335-
end
336-
337327
msg = [
338328
msg,
339-
state_info,
329+
"\nState: ",
330+
inspect(state, inspect_opts),
340331
"\nCallback mode: ",
341332
"#{inspect(callback_mode, inspect_opts)}, state_enter: #{state_enter?}"
342333
| format_client_info(client)

lib/logger/test/logger/translator_test.exs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ defmodule Logger.TranslatorTest do
467467
assert capture_log(:debug, fn ->
468468
catch_exit(:gen_statem.call(pid, :error))
469469
end) =~ """
470-
[:ok, :ok, :ok, ...]
470+
State: {:started, [:ok, ...]}
471471
"""
472472
after
473473
Application.put_env(:logger, :translator_inspect_opts, [])
@@ -484,8 +484,7 @@ defmodule Logger.TranslatorTest do
484484
.*
485485
Queue: .*
486486
Postponed: \[\]
487-
State: :started
488-
Data: :ok
487+
State: {:started, :ok}
489488
Callback mode: :state_functions, state_enter: false
490489
Client #PID<\d+\.\d+\.\d+> is alive
491490
.*
@@ -510,8 +509,7 @@ defmodule Logger.TranslatorTest do
510509
.*
511510
Queue: .*
512511
Postponed: \[\]
513-
State: :started
514-
Data: :ok
512+
State: {:started, :ok}
515513
Callback mode: :state_functions, state_enter: false
516514
Client :named_client is alive
517515
.*
@@ -535,8 +533,7 @@ defmodule Logger.TranslatorTest do
535533
.*
536534
Queue: .*
537535
Postponed: \[\]
538-
State: :started
539-
Data: :ok
536+
State: {:started, :ok}
540537
Callback mode: :state_functions, state_enter: false
541538
Client #PID<\d+\.\d+\.\d+> is dead
542539
"""s
@@ -555,8 +552,7 @@ defmodule Logger.TranslatorTest do
555552
.*
556553
Queue: .*
557554
Postponed: \[\]
558-
State: :started
559-
Data: :ok
555+
State: {:started, :ok}
560556
Callback mode: :state_functions, state_enter: false
561557
"""s
562558
end

0 commit comments

Comments
 (0)