Fixes 'undefined' event handler options for severity mapping (#37)

This commit is contained in:
Aleksey Kashapov 2024-06-03 16:53:07 +03:00 committed by GitHub
parent 81219ba540
commit 072825ee71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -5,7 +5,7 @@
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
{<<"genlib">>,
{git,"https://github.com/valitydev/genlib.git",
{ref,"82c5ff3866e3019eb347c7f1d8f1f847bed28c10"}},
{ref,"f6074551d6586998e91a97ea20acb47241254ff3"}},
0},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},0},

View File

@ -448,8 +448,9 @@ get_event_severity(UnknownEventType, _Meta, Opts) ->
%% Internal functions
%%
-spec map_severity(nonempty_list(atom()), options(), severity()) -> severity().
map_severity(Code, Opts, Default) ->
EventsSeverity = maps:get(events_severity, Opts, #{}),
map_severity(Code, Opts0, Default) ->
Opts1 = genlib:define(Opts0, #{}),
EventsSeverity = maps:get(events_severity, Opts1, #{}),
maps:get(Code, EventsSeverity, Default).
-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(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_() -> _.