Skip to content

Commit cc55a82

Browse files
Emit notice logs in :console backend
yes.. this is not very "backward compatible".. I guess adding some config flag to enable it, and default it to false.. would be proper (?)
1 parent c46e14d commit cc55a82

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/logger/lib/logger/backends/console.ex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,14 @@ defmodule Logger.Backends.Console do
236236
info: Keyword.get(colors, :info, :normal),
237237
warn: Keyword.get(colors, :warn, :yellow),
238238
error: Keyword.get(colors, :error, :red),
239+
notice: Keyword.get(colors, :error, :blue),
239240
enabled: Keyword.get(colors, :enabled, IO.ANSI.enabled?())
240241
}
241242
end
242243

243-
defp log_event(level, msg, ts, md, %{device: device} = state) do
244+
defp log_event(_level, msg, ts, md, %{device: device} = state) do
245+
{:erl_level, level} = List.keyfind(md, :erl_level, 0, :not_found)
246+
244247
output = format_event(level, msg, ts, md, state)
245248
%{state | ref: async_io(device, output), output: output}
246249
end

lib/logger/lib/logger/formatter.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ defmodule Logger.Formatter do
166166
defp levelpad(:debug), do: ""
167167
defp levelpad(:info), do: " "
168168
defp levelpad(:warn), do: " "
169+
defp levelpad(:notice), do: " "
169170
defp levelpad(:error), do: ""
170171

171172
defp metadata([{key, value} | metadata]) do

0 commit comments

Comments
 (0)