mirror of
https://github.com/valitydev/woody_erlang.git
synced 2024-11-06 02:15:19 +00:00
Fixes 'undefined' event handler options for severity mapping
This commit is contained in:
parent
81219ba540
commit
05be346a5c
@ -5,7 +5,7 @@
|
|||||||
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
|
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
|
||||||
{<<"genlib">>,
|
{<<"genlib">>,
|
||||||
{git,"https://github.com/valitydev/genlib.git",
|
{git,"https://github.com/valitydev/genlib.git",
|
||||||
{ref,"82c5ff3866e3019eb347c7f1d8f1f847bed28c10"}},
|
{ref,"f6074551d6586998e91a97ea20acb47241254ff3"}},
|
||||||
0},
|
0},
|
||||||
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0},
|
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0},
|
||||||
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},0},
|
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},0},
|
||||||
|
@ -448,8 +448,9 @@ get_event_severity(UnknownEventType, _Meta, Opts) ->
|
|||||||
%% Internal functions
|
%% Internal functions
|
||||||
%%
|
%%
|
||||||
-spec map_severity(nonempty_list(atom()), options(), severity()) -> severity().
|
-spec map_severity(nonempty_list(atom()), options(), severity()) -> severity().
|
||||||
map_severity(Code, Opts, Default) ->
|
map_severity(Code, Opts0, Default) ->
|
||||||
EventsSeverity = maps:get(events_severity, Opts, #{}),
|
Opts1 = genlib:define(Opts0, #{}),
|
||||||
|
EventsSeverity = maps:get(events_severity, Opts1, #{}),
|
||||||
maps:get(Code, EventsSeverity, Default).
|
maps:get(Code, EventsSeverity, Default).
|
||||||
|
|
||||||
-spec format_service_request(map(), options()) -> msg().
|
-spec format_service_request(map(), options()) -> msg().
|
||||||
@ -1644,7 +1645,11 @@ event_severity_defaults_test_() ->
|
|||||||
),
|
),
|
||||||
?_assertEqual(warning, get_event_severity(?EV_INTERNAL_ERROR, Meta#{error => test, reason => test}, Opts)),
|
?_assertEqual(warning, get_event_severity(?EV_INTERNAL_ERROR, Meta#{error => test, reason => test}, Opts)),
|
||||||
|
|
||||||
?_assertEqual(debug, get_event_severity(?EV_TRACE, Meta, Opts))
|
?_assertEqual(debug, get_event_severity(?EV_TRACE, Meta, Opts)),
|
||||||
|
|
||||||
|
%% NOTE Ensure that 'DEFAULT_HANDLER_OPTS' from woody_util is
|
||||||
|
%% treated as default severity mapping.
|
||||||
|
?_assertEqual(debug, get_event_severity(?EV_TRACE, Meta, undefined))
|
||||||
].
|
].
|
||||||
|
|
||||||
-spec event_severity_all_info_test_() -> _.
|
-spec event_severity_all_info_test_() -> _.
|
||||||
|
Loading…
Reference in New Issue
Block a user