Fix testcase for logger_formatter

This commit is contained in:
terry-xiaoyu 2019-10-23 10:26:25 +08:00
parent 1dfbe8e166
commit 9aef5d60e0
1 changed files with 3 additions and 0 deletions

View File

@ -567,6 +567,8 @@ check_config(_Config) ->
%% Test that formatter config can be changed, and that the default %% Test that formatter config can be changed, and that the default
%% template is updated accordingly %% template is updated accordingly
update_config(_Config) -> update_config(_Config) ->
#{level := OldLevel} = logger:get_primary_config(),
logger:set_primary_config(level, debug),
{error,{not_found,?MODULE}} = logger:update_formatter_config(?MODULE,#{}), {error,{not_found,?MODULE}} = logger:update_formatter_config(?MODULE,#{}),
logger:add_handler_filter(default,silence,{fun(_,_) -> stop end,ok}), logger:add_handler_filter(default,silence,{fun(_,_) -> stop end,ok}),
@ -596,6 +598,7 @@ update_config(_Config) ->
?assertMatch({error,{invalid_formatter_config,emqx_logger_formatter,{depth,bad}}}, ?assertMatch({error,{invalid_formatter_config,emqx_logger_formatter,{depth,bad}}},
logger:update_formatter_config(?MODULE,depth,bad)), logger:update_formatter_config(?MODULE,depth,bad)),
logger:set_primary_config(level, OldLevel),
ok. ok.
update_config(cleanup,_Config) -> update_config(cleanup,_Config) ->