@@ -586,24 +586,24 @@ defmodule Logger do
586
586
end
587
587
588
588
@ doc """
589
- Alters the current process metadata according to the given keyword list .
589
+ Alters the current process metadata according to the given enumerable .
590
590
591
- This function will merge the given keyword list into the existing metadata,
591
+ This function will merge the given enumerable into the existing metadata,
592
592
with the exception of setting a key to `nil`, which will remove that key
593
593
from the metadata.
594
594
595
595
Note some metadata keys are reserved and cannot be overridden. See
596
596
[the module documentation](#module-metadata) for more information.
597
597
"""
598
- @ spec metadata ( metadata ) :: :ok
599
- def metadata ( keyword ) do
598
+ @ spec metadata ( Enumerable . t ( { atom ( ) , term ( ) } ) ) :: :ok
599
+ def metadata ( enumerable ) do
600
600
case :logger . get_process_metadata ( ) do
601
601
:undefined ->
602
- reset_metadata ( keyword )
602
+ reset_metadata ( enumerable )
603
603
604
604
map when is_map ( map ) ->
605
605
metadata =
606
- Enum . reduce ( keyword , map , fn
606
+ Enum . reduce ( enumerable , map , fn
607
607
{ k , nil } , acc -> Map . delete ( acc , k )
608
608
{ k , v } , acc -> Map . put ( acc , k , v )
609
609
end )
@@ -627,11 +627,11 @@ defmodule Logger do
627
627
end
628
628
629
629
@ doc """
630
- Resets the current process metadata to the given keyword list .
630
+ Resets the current process metadata to the given enumerable .
631
631
"""
632
- @ spec reset_metadata ( metadata ) :: :ok
633
- def reset_metadata ( keyword \\ [ ] ) do
634
- :ok = :logger . set_process_metadata ( filter_out_nils ( keyword ) )
632
+ @ spec reset_metadata ( Enumerable . t ( { atom ( ) , term ( ) } ) ) :: :ok
633
+ def reset_metadata ( enumerable \\ [ ] ) do
634
+ :ok = :logger . set_process_metadata ( filter_out_nils ( enumerable ) )
635
635
end
636
636
637
637
defp filter_out_nils ( keyword ) do
0 commit comments