diff --git a/rebar.lock b/rebar.lock index 191d79b..a6b57f3 100644 --- a/rebar.lock +++ b/rebar.lock @@ -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}, diff --git a/src/woody_event_handler.erl b/src/woody_event_handler.erl index 493eea4..9388699 100644 --- a/src/woody_event_handler.erl +++ b/src/woody_event_handler.erl @@ -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_() -> _.