Skip to content

Commit 510ac44

Browse files
Henning LJosé Valim
authored andcommitted
Add missing discard_threshold option (#7533)
Signed-off-by: José Valim <[email protected]>
1 parent e13c944 commit 510ac44

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/logger/lib/logger.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ defmodule Logger do
506506
:sync_threshold,
507507
:truncate,
508508
:level,
509-
:utc_log
509+
:utc_log,
510+
:discard_threshold
510511
]
511512
@spec configure(keyword) :: :ok
512513
def configure(options) do

lib/logger/test/logger_test.exs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,21 @@ defmodule LoggerTest do
348348
Logger.App.stop()
349349
Application.start(:logger)
350350
end
351+
352+
test "configure/1 sets options" do
353+
Logger.configure(sync_threshold: 10)
354+
Logger.configure(truncate: 4048)
355+
Logger.configure(utc_log: true)
356+
Logger.configure(discard_threshold: 10_000)
357+
logger_data = Logger.Config.__data__()
358+
assert Map.get(logger_data, :sync_threshold) == 10
359+
assert Map.get(logger_data, :truncate) == 4048
360+
assert Map.get(logger_data, :utc_log) == true
361+
assert Map.get(logger_data, :discard_threshold) == 10_000
362+
after
363+
Logger.configure(sync_threshold: 20)
364+
Logger.configure(sync_threshold: 8096)
365+
Logger.configure(utc_log: false)
366+
Logger.configure(discard_threshold: 500)
367+
end
351368
end

0 commit comments

Comments
 (0)