File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -506,7 +506,8 @@ defmodule Logger do
506
506
:sync_threshold ,
507
507
:truncate ,
508
508
:level ,
509
- :utc_log
509
+ :utc_log ,
510
+ :discard_threshold
510
511
]
511
512
@ spec configure ( keyword ) :: :ok
512
513
def configure ( options ) do
Original file line number Diff line number Diff line change @@ -348,4 +348,21 @@ defmodule LoggerTest do
348
348
Logger.App . stop ( )
349
349
Application . start ( :logger )
350
350
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
351
368
end
You can’t perform that action at this time.
0 commit comments