aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-06-05 20:03:21 +0200
committerSiri Hansen <[email protected]>2018-06-08 14:45:56 +0200
commit35c311607ed5b5a9ddea8c9a9be7c3b41845c737 (patch)
tree82a7e9ce68b267363ad391acc18fbac9bb4ea697
parent6f753ccf5178a809a7a26f692249bdfb5985335e (diff)
downloadotp-35c311607ed5b5a9ddea8c9a9be7c3b41845c737.tar.gz
otp-35c311607ed5b5a9ddea8c9a9be7c3b41845c737.tar.bz2
otp-35c311607ed5b5a9ddea8c9a9be7c3b41845c737.zip
[logger] Change concept of 'global' configuration to 'primary' configuration
Function names changed: get/set/update_logger_config -> get/set/update_primary_config add/remove_logger_filter -> add/remove_primary_filter
-rw-r--r--lib/kernel/src/logger.erl68
-rw-r--r--lib/kernel/src/logger_backend.erl4
-rw-r--r--lib/kernel/src/logger_config.erl14
-rw-r--r--lib/kernel/src/logger_internal.hrl2
-rw-r--r--lib/kernel/src/logger_server.erl32
-rw-r--r--lib/kernel/test/logger_SUITE.erl96
-rw-r--r--lib/kernel/test/logger_bench_SUITE.erl18
-rw-r--r--lib/kernel/test/logger_disk_log_h_SUITE.erl2
-rw-r--r--lib/kernel/test/logger_env_var_SUITE.erl24
9 files changed, 130 insertions, 130 deletions
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl
index f8661ea228..9f96a537bc 100644
--- a/lib/kernel/src/logger.erl
+++ b/lib/kernel/src/logger.erl
@@ -35,16 +35,16 @@
%% Configuration
-export([add_handler/3, remove_handler/1,
- add_logger_filter/2, add_handler_filter/3,
- remove_logger_filter/1, remove_handler_filter/2,
+ add_primary_filter/2, add_handler_filter/3,
+ remove_primary_filter/1, remove_handler_filter/2,
set_module_level/2,
unset_module_level/1, unset_module_level/0,
get_module_level/0, get_module_level/1,
- set_logger_config/1, set_logger_config/2,
+ set_primary_config/1, set_primary_config/2,
set_handler_config/2, set_handler_config/3,
- update_logger_config/1, update_handler_config/2,
+ update_primary_config/1, update_handler_config/2,
update_formatter_config/2, update_formatter_config/3,
- get_logger_config/0, get_handler_config/1,
+ get_primary_config/0, get_handler_config/1,
add_handlers/1]).
%% Private configuration
@@ -310,11 +310,11 @@ internal_log(Level,Term) when is_atom(Level) ->
%%%-----------------------------------------------------------------
%%% Configuration
--spec add_logger_filter(FilterId,Filter) -> ok | {error,term()} when
+-spec add_primary_filter(FilterId,Filter) -> ok | {error,term()} when
FilterId :: filter_id(),
Filter :: filter().
-add_logger_filter(FilterId,Filter) ->
- logger_server:add_filter(logger,{FilterId,Filter}).
+add_primary_filter(FilterId,Filter) ->
+ logger_server:add_filter(primary,{FilterId,Filter}).
-spec add_handler_filter(HandlerId,FilterId,Filter) -> ok | {error,term()} when
HandlerId :: handler_id(),
@@ -324,10 +324,10 @@ add_handler_filter(HandlerId,FilterId,Filter) ->
logger_server:add_filter(HandlerId,{FilterId,Filter}).
--spec remove_logger_filter(FilterId) -> ok | {error,term()} when
+-spec remove_primary_filter(FilterId) -> ok | {error,term()} when
FilterId :: filter_id().
-remove_logger_filter(FilterId) ->
- logger_server:remove_filter(logger,FilterId).
+remove_primary_filter(FilterId) ->
+ logger_server:remove_filter(primary,FilterId).
-spec remove_handler_filter(HandlerId,FilterId) -> ok | {error,term()} when
HandlerId :: handler_id(),
@@ -347,16 +347,16 @@ add_handler(HandlerId,Module,Config) ->
remove_handler(HandlerId) ->
logger_server:remove_handler(HandlerId).
--spec set_logger_config(Key,Value) -> ok | {error,term()} when
+-spec set_primary_config(Key,Value) -> ok | {error,term()} when
Key :: atom(),
Value :: term().
-set_logger_config(Key,Value) ->
- logger_server:set_config(logger,Key,Value).
+set_primary_config(Key,Value) ->
+ logger_server:set_config(primary,Key,Value).
--spec set_logger_config(Config) -> ok | {error,term()} when
+-spec set_primary_config(Config) -> ok | {error,term()} when
Config :: config().
-set_logger_config(Config) ->
- logger_server:set_config(logger,Config).
+set_primary_config(Config) ->
+ logger_server:set_config(primary,Config).
-spec set_handler_config(HandlerId,Key,Value) -> ok | {error,term()} when
HandlerId :: handler_id(),
@@ -371,10 +371,10 @@ set_handler_config(HandlerId,Key,Value) ->
set_handler_config(HandlerId,Config) ->
logger_server:set_config(HandlerId,Config).
--spec update_logger_config(Config) -> ok | {error,term()} when
+-spec update_primary_config(Config) -> ok | {error,term()} when
Config :: config().
-update_logger_config(Config) ->
- logger_server:update_config(logger,Config).
+update_primary_config(Config) ->
+ logger_server:update_config(primary,Config).
-spec update_handler_config(HandlerId,Config) -> ok | {error,term()} when
HandlerId :: handler_id(),
@@ -382,10 +382,10 @@ update_logger_config(Config) ->
update_handler_config(HandlerId,Config) ->
logger_server:update_config(HandlerId,Config).
--spec get_logger_config() -> {ok,Config} when
+-spec get_primary_config() -> {ok,Config} when
Config :: config().
-get_logger_config() ->
- {ok,Config} = logger_config:get(?LOGGER_TABLE,logger),
+get_primary_config() ->
+ {ok,Config} = logger_config:get(?LOGGER_TABLE,primary),
{ok,maps:remove(handlers,Config)}.
-spec get_handler_config(HandlerId) -> {ok,{Module,Config}} | {error,term()} when
@@ -492,13 +492,13 @@ unset_process_metadata() ->
_ = erase(?LOGGER_META_KEY),
ok.
--spec i() -> #{logger=>config(),
+-spec i() -> #{primary=>config(),
handlers=>[{handler_id(),module(),config()}],
module_levels=>[{module(),level() | all | none}]}.
i() ->
i(term).
--spec i(term) -> #{logger=>config(),
+-spec i(term) -> #{primary=>config(),
handlers=>[{handler_id(),module(),config()}],
module_levels=>[{module(),level() | all | none}]};
(print) -> ok;
@@ -506,7 +506,7 @@ i() ->
i(_Action = print) ->
io:put_chars(i(string));
i(_Action = string) ->
- #{logger := #{level := Level,
+ #{primary := #{level := Level,
filters := Filters,
filter_default := FilterDefault},
handlers := HandlerConfigs,
@@ -522,8 +522,8 @@ i(_Action = string) ->
print_module_levels(Modules)
];
i(_Action = term) ->
- {Logger, Handlers, Modules} = logger_config:get(?LOGGER_TABLE),
- #{logger=>maps:remove(handlers,Logger),
+ {Primary, Handlers, Modules} = logger_config:get(?LOGGER_TABLE),
+ #{primary=>maps:remove(handlers,Primary),
handlers=>lists:keysort(1,Handlers),
module_levels=>lists:keysort(1,Modules)}.
@@ -576,13 +576,13 @@ print_module_levels(ModuleLevels) ->
%% tree is started.
internal_init_logger() ->
try
- ok = logger:set_logger_config(level, get_logger_level()),
- ok = logger:set_logger_config(filter_default, get_logger_filter_default()),
+ ok = logger:set_primary_config(level, get_logger_level()),
+ ok = logger:set_primary_config(filter_default, get_primary_filter_default()),
- [case logger:add_logger_filter(Id, Filter) of
+ [case logger:add_primary_filter(Id, Filter) of
ok -> ok;
{error, Reason} -> throw(Reason)
- end || {Id, Filter} <- get_logger_filters()],
+ end || {Id, Filter} <- get_primary_filters()],
_ = [[case logger:set_module_level(Module, Level) of
ok -> ok;
@@ -703,7 +703,7 @@ get_logger_level() ->
throw({logger_level, Level})
end.
-get_logger_filter_default() ->
+get_primary_filter_default() ->
case lists:keyfind(filters,1,get_logger_env()) of
{filters,Default,_} ->
Default;
@@ -711,7 +711,7 @@ get_logger_filter_default() ->
log
end.
-get_logger_filters() ->
+get_primary_filters() ->
lists:foldl(
fun({filters, _, Filters}, _Acc) ->
Filters;
diff --git a/lib/kernel/src/logger_backend.erl b/lib/kernel/src/logger_backend.erl
index b3cf7d67dd..a73b681e0d 100644
--- a/lib/kernel/src/logger_backend.erl
+++ b/lib/kernel/src/logger_backend.erl
@@ -28,9 +28,9 @@
%%%-----------------------------------------------------------------
%%% The default logger backend
log_allowed(Log, Tid) ->
- {ok,Config} = logger_config:get(Tid,logger),
+ {ok,Config} = logger_config:get(Tid,primary),
Filters = maps:get(filters,Config,[]),
- case apply_filters(logger,Log,Filters,Config) of
+ case apply_filters(primary,Log,Filters,Config) of
stop ->
ok;
Log1 ->
diff --git a/lib/kernel/src/logger_config.erl b/lib/kernel/src/logger_config.erl
index 113c8140cf..7b2148d034 100644
--- a/lib/kernel/src/logger_config.erl
+++ b/lib/kernel/src/logger_config.erl
@@ -54,7 +54,7 @@ allow(Tid,Level,Module) ->
end.
allow(Tid,Level) ->
- GlobalLevelInt = ets:lookup_element(Tid,?LOGGER_KEY,2),
+ GlobalLevelInt = ets:lookup_element(Tid,?PRIMARY_KEY,2),
level_to_int(Level) =< GlobalLevelInt.
exist(Tid,What) ->
@@ -71,7 +71,7 @@ get(Tid,What) ->
end.
get(Tid,What,Level) ->
- MS = [{{table_key(What),'$1','$2'}, % logger config
+ MS = [{{table_key(What),'$1','$2'}, % primary config
[{'>=','$1',level_to_int(Level)}],
['$2']},
{{table_key(What),'$1','$2','$3'}, % handler config
@@ -94,7 +94,7 @@ set(Tid,What,Config) ->
%% Should do this only if the level has actually changed. Possibly
%% overwrite instead of delete?
case What of
- logger ->
+ primary ->
_ = ets:select_delete(Tid,[{{'_',{'$1',cached}},
[{'=/=','$1',LevelInt}],
[true]}]),
@@ -125,16 +125,16 @@ get_module_level(Tid) ->
lists:sort([{M,int_to_level(L)} || {M,L} <- Modules]).
cache_module_level(Tid,Module) ->
- GlobalLevelInt = ets:lookup_element(Tid,?LOGGER_KEY,2),
+ GlobalLevelInt = ets:lookup_element(Tid,?PRIMARY_KEY,2),
ets:insert_new(Tid,{Module,{GlobalLevelInt,cached}}),
ok.
get(Tid) ->
- {ok,Logger} = get(Tid,logger),
+ {ok,Primary} = get(Tid,primary),
HMS = [{{table_key('$1'),'_','$2','$3'},[],[{{'$1','$3','$2'}}]}],
Handlers = ets:select(Tid,HMS),
Modules = get_module_level(Tid),
- {Logger,Handlers,Modules}.
+ {Primary,Handlers,Modules}.
level_to_int(none) -> ?LOG_NONE;
level_to_int(emergency) -> ?EMERGENCY;
@@ -161,5 +161,5 @@ int_to_level(?LOG_ALL) -> all.
%%%-----------------------------------------------------------------
%%% Internal
-table_key(logger) -> ?LOGGER_KEY;
+table_key(primary) -> ?PRIMARY_KEY;
table_key(HandlerId) -> {?HANDLER_KEY,HandlerId}.
diff --git a/lib/kernel/src/logger_internal.hrl b/lib/kernel/src/logger_internal.hrl
index a0962cb8e0..8941409a25 100644
--- a/lib/kernel/src/logger_internal.hrl
+++ b/lib/kernel/src/logger_internal.hrl
@@ -19,7 +19,7 @@
%%
-include_lib("kernel/include/logger.hrl").
-define(LOGGER_TABLE,logger).
--define(LOGGER_KEY,'$logger_config$').
+-define(PRIMARY_KEY,'$primary_config$').
-define(HANDLER_KEY,'$handler_config$').
-define(LOGGER_META_KEY,'$logger_metadata$').
-define(STANDARD_HANDLER, default).
diff --git a/lib/kernel/src/logger_server.erl b/lib/kernel/src/logger_server.erl
index adbb2bc009..c7d386ab82 100644
--- a/lib/kernel/src/logger_server.erl
+++ b/lib/kernel/src/logger_server.erl
@@ -78,7 +78,7 @@ remove_filter(Owner,FilterId) ->
set_module_level(Modules,Level) when is_list(Modules) ->
case lists:all(fun(M) -> is_atom(M) end,Modules) of
true ->
- case sanity_check(logger,level,Level) of
+ case sanity_check(primary,level,Level) of
ok -> call({set_module_level,Modules,Level});
Error -> Error
end;
@@ -138,9 +138,9 @@ update_formatter_config(_HandlerId, FormatterConfig) ->
init([]) ->
process_flag(trap_exit, true),
Tid = logger_config:new(?LOGGER_TABLE),
- LoggerConfig = maps:merge(default_config(logger),
+ PrimaryConfig = maps:merge(default_config(primary),
#{handlers=>[simple]}),
- logger_config:create(Tid,logger,LoggerConfig),
+ logger_config:create(Tid,primary,PrimaryConfig),
SimpleConfig0 = maps:merge(default_config(simple),
#{filter_default=>stop,
filters=>?DEFAULT_HANDLER_FILTERS}),
@@ -166,9 +166,9 @@ handle_call({add_handler,Id,Module,HConfig}, From, #state{tid=Tid}=State) ->
case erlang:function_exported(Module, log, 2) of
true ->
logger_config:create(Tid,Id,Module,HConfig1),
- {ok,Config} = do_get_config(Tid,logger),
+ {ok,Config} = do_get_config(Tid,primary),
Handlers = maps:get(handlers,Config,[]),
- do_set_config(Tid,logger,
+ do_set_config(Tid,primary,
Config#{handlers=>[Id|Handlers]});
false ->
{error,{invalid_handler,
@@ -182,7 +182,7 @@ handle_call({add_handler,Id,Module,HConfig}, From, #state{tid=Tid}=State) ->
handle_call({remove_handler,HandlerId}, From, #state{tid=Tid}=State) ->
case logger_config:get(Tid,HandlerId) of
{ok,{Module,HConfig}} ->
- {ok,Config} = do_get_config(Tid,logger),
+ {ok,Config} = do_get_config(Tid,primary),
Handlers0 = maps:get(handlers,Config,[]),
Handlers = lists:delete(HandlerId,Handlers0),
call_h_async(
@@ -191,7 +191,7 @@ handle_call({remove_handler,HandlerId}, From, #state{tid=Tid}=State) ->
call_h(Module,removing_handler,[HConfig],ok)
end,
fun(_Res) ->
- do_set_config(Tid,logger,Config#{handlers=>Handlers}),
+ do_set_config(Tid,primary,Config#{handlers=>Handlers}),
logger_config:delete(Tid,HandlerId),
ok
end,From,State);
@@ -215,9 +215,9 @@ handle_call({update_config,Id,NewConfig}, From, #state{tid=Tid}=State) ->
Error ->
{reply,Error,State}
end;
-handle_call({set_config,logger,Config}, _From, #state{tid=Tid}=State) ->
- {ok,#{handlers:=Handlers}} = logger_config:get(Tid,logger),
- Reply = do_set_config(Tid,logger,Config#{handlers=>Handlers}),
+handle_call({set_config,primary,Config}, _From, #state{tid=Tid}=State) ->
+ {ok,#{handlers:=Handlers}} = logger_config:get(Tid,primary),
+ Reply = do_set_config(Tid,primary,Config#{handlers=>Handlers}),
{reply,Reply,State};
handle_call({set_config,HandlerId,Config}, From, #state{tid=Tid}=State) ->
case logger_config:get(Tid,HandlerId) of
@@ -282,7 +282,7 @@ handle_info({Ref,_Reply},State) when is_reference(Ref) ->
handle_info({'DOWN',_Ref,_Proc,_Pid,_Reason} = Down,State) ->
call_h_reply(Down,State);
handle_info(Unexpected,State) when element(1,Unexpected) == 'EXIT' ->
- %% The simple logger will send an 'EXIT' message when it is replaced
+ %% The simple handler will send an 'EXIT' message when it is replaced
%% We may as well ignore all 'EXIT' messages that we get
?LOG_INTERNAL(debug,
[{logger,got_unexpected_message},
@@ -355,7 +355,7 @@ do_set_config(Tid,Id,Config) ->
logger_config:set(Tid,Id,Config),
ok.
-default_config(logger) ->
+default_config(primary) ->
#{level=>info,
filters=>[],
filter_default=>log};
@@ -381,8 +381,8 @@ sanity_check_1(Owner,Config) when is_list(Config) ->
catch throw:Error -> {error,Error}
end.
-get_type(logger) ->
- logger;
+get_type(primary) ->
+ primary;
get_type(Id) ->
check_id(Id),
handler.
@@ -399,8 +399,8 @@ check_config(Owner,[{filter_default,FD}|Config]) ->
check_config(handler,[{formatter,Formatter}|Config]) ->
check_formatter(Formatter),
check_config(handler,Config);
-check_config(logger,[C|_]) ->
- throw({invalid_logger_config,C});
+check_config(primary,[C|_]) ->
+ throw({invalid_primary_config,C});
check_config(handler,[{_,_}|Config]) ->
%% Arbitrary config elements are allowed for handlers
check_config(handler,Config);
diff --git a/lib/kernel/test/logger_SUITE.erl b/lib/kernel/test/logger_SUITE.erl
index 1057768eeb..bbf60cad74 100644
--- a/lib/kernel/test/logger_SUITE.erl
+++ b/lib/kernel/test/logger_SUITE.erl
@@ -63,7 +63,7 @@ end_per_group(_Group, _Config) ->
ok.
init_per_testcase(_TestCase, Config) ->
- {ok,LC} = logger:get_logger_config(),
+ {ok,LC} = logger:get_primary_config(),
[{logger_config,LC}|Config].
end_per_testcase(Case, Config) ->
@@ -155,11 +155,11 @@ multiple_handlers(cleanup,_Config) ->
add_remove_filter(_Config) ->
ok = logger:add_handler(h1,?MODULE,#{level=>info,filter_default=>log}),
LF = {fun(Log,_) -> Log#{level=>error} end, []},
- ok = logger:add_logger_filter(lf,LF),
- {error,{already_exist,lf}} = logger:add_logger_filter(lf,LF),
- {error,{already_exist,lf}} = logger:add_logger_filter(lf,{fun(Log,_) ->
- Log
- end, []}),
+ ok = logger:add_primary_filter(lf,LF),
+ {error,{already_exist,lf}} = logger:add_primary_filter(lf,LF),
+ {error,{already_exist,lf}} = logger:add_primary_filter(lf,{fun(Log,_) ->
+ Log
+ end, []}),
?LOG_INFO("hello",[]),
ok = check_logged(error,"hello",[],?MY_LOC(1)),
ok = check_no_log(),
@@ -180,8 +180,8 @@ add_remove_filter(_Config) ->
ok = check_logged(mylevel,"hello",[],?MY_LOC(1)),
ok = check_logged(error,"hello",[],?MY_LOC(2)),
- ok = logger:remove_logger_filter(lf),
- {error,{not_found,lf}} = logger:remove_logger_filter(lf),
+ ok = logger:remove_primary_filter(lf),
+ {error,{not_found,lf}} = logger:remove_primary_filter(lf),
?LOG_INFO("hello",[]),
ok = check_logged(info,"hello",[],?MY_LOC(1)),
@@ -203,7 +203,7 @@ add_remove_filter(_Config) ->
ok.
add_remove_filter(cleanup,_Config) ->
- logger:remove_logger_filter(lf),
+ logger:remove_primary_filter(lf),
logger:remove_handler(h1),
logger:remove_handler(h2),
ok.
@@ -241,30 +241,30 @@ change_config(_Config) ->
{ok,{_,C4}} = logger:get_handler_config(h1),
C4 = C3#{custom:=new_custom},
- %% Change logger config: Single key
- {ok,LConfig0} = logger:get_logger_config(),
- ok = logger:set_logger_config(level,warning),
- {ok,LConfig1} = logger:get_logger_config(),
+ %% Change primary config: Single key
+ {ok,LConfig0} = logger:get_primary_config(),
+ ok = logger:set_primary_config(level,warning),
+ {ok,LConfig1} = logger:get_primary_config(),
LConfig1 = LConfig0#{level:=warning},
- %% Change logger config: Map
- ok = logger:update_logger_config(#{level=>error}),
- {ok,LConfig2} = logger:get_logger_config(),
+ %% Change primary config: Map
+ ok = logger:update_primary_config(#{level=>error}),
+ {ok,LConfig2} = logger:get_primary_config(),
LConfig2 = LConfig1#{level:=error},
- %% Overwrite logger config - check that defaults are added
- ok = logger:set_logger_config(#{filter_default=>stop}),
+ %% Overwrite primary config - check that defaults are added
+ ok = logger:set_primary_config(#{filter_default=>stop}),
{ok,#{level:=info,filters:=[],filter_default:=stop}=LC1} =
- logger:get_logger_config(),
+ logger:get_primary_config(),
3 = maps:size(LC1),
%% Check that internal 'handlers' field has not been changed
#{handlers:=HCs} = logger:i(),
HIds1 = [Id || {Id,_,_} <- HCs],
- {ok,#{handlers:=HIds2}} = logger_config:get(?LOGGER_TABLE,logger),
+ {ok,#{handlers:=HIds2}} = logger_config:get(?LOGGER_TABLE,primary),
HIds1 = lists:sort(HIds2),
%% Cleanup
- ok = logger:set_logger_config(LConfig0),
+ ok = logger:set_primary_config(LConfig0),
[] = test_server:messages_get(),
ok.
@@ -272,7 +272,7 @@ change_config(_Config) ->
change_config(cleanup,Config) ->
logger:remove_handler(h1),
LC = ?config(logger_config,Config),
- logger:set_logger_config(LC),
+ logger:set_primary_config(LC),
ok.
set_formatter(_Config) ->
@@ -298,11 +298,11 @@ log_no_levels(_Config) ->
ok = check_logged(notice,M1,#{}),
Levels = [emergency,alert,critical,error,warning,notice,info,debug],
- ok = logger:set_logger_config(level,none),
+ ok = logger:set_primary_config(level,none),
[logger:Level(#{Level=>rep}) || Level <- Levels],
ok = check_no_log(),
- ok = logger:set_logger_config(level,all),
+ ok = logger:set_primary_config(level,all),
M2 = ?map_rep,
?LOG_NOTICE(M2),
ok = check_logged(notice,M2,#{}),
@@ -329,12 +329,12 @@ log_no_levels(_Config) ->
ok.
log_no_levels(cleanup,_Config) ->
logger:remove_handler(h1),
- logger:set_logger_level(level,info),
+ logger:set_primary_config(level,info),
logger:unset_module_level(?MODULE),
ok.
log_all_levels_api(_Config) ->
- ok = logger:set_logger_config(level,all),
+ ok = logger:set_primary_config(level,all),
ok = logger:add_handler(h1,?MODULE,#{level=>all,filter_default=>log}),
test_api(emergency),
test_api(alert),
@@ -349,7 +349,7 @@ log_all_levels_api(_Config) ->
log_all_levels_api(cleanup,_Config) ->
logger:remove_handler(h1),
- logger:set_logger_config(level,info),
+ logger:set_primary_config(level,info),
ok.
macros(_Config) ->
@@ -368,14 +368,14 @@ set_level(_Config) ->
ok = check_no_log(),
logger:info(M1=?map_rep),
ok = check_logged(info,M1,#{}),
- ok = logger:set_logger_config(level,debug),
+ ok = logger:set_primary_config(level,debug),
logger:debug(M2=?map_rep),
ok = check_logged(debug,M2,#{}),
ok.
set_level(cleanup,_Config) ->
logger:remove_handler(h1),
- logger:set_logger_config(level,info),
+ logger:set_primary_config(level,info),
ok.
set_module_level(_Config) ->
@@ -424,13 +424,13 @@ set_module_level(cleanup,_Config) ->
cache_module_level(_Config) ->
ok = logger:unset_module_level(?MODULE),
- [] = ets:lookup(logger,?MODULE), %dirty - add API in logger_config?
+ [] = ets:lookup(?LOGGER_TABLE,?MODULE), %dirty - add API in logger_config?
?LOG_INFO(?map_rep),
%% Caching is done asynchronously, so wait a bit for the update
timer:sleep(100),
- [_] = ets:lookup(logger,?MODULE), %dirty - add API in logger_config?
+ [_] = ets:lookup(?LOGGER_TABLE,?MODULE), %dirty - add API in logger_config?
ok = logger:unset_module_level(?MODULE),
- [] = ets:lookup(logger,?MODULE), %dirty - add API in logger_config?
+ [] = ets:lookup(?LOGGER_TABLE,?MODULE), %dirty - add API in logger_config?
ok.
cache_module_level(cleanup,_Config) ->
@@ -468,18 +468,18 @@ filter_failed(_Config) ->
%% Logger filters
{error,{invalid_filter,_}} =
- logger:add_logger_filter(lf,{fun(_) -> ok end,args}),
- ok = logger:add_logger_filter(lf,{fun(_,_) -> a=b end,args}),
- {ok,#{filters:=[_]}} = logger:get_logger_config(),
+ logger:add_primary_filter(lf,{fun(_) -> ok end,args}),
+ ok = logger:add_primary_filter(lf,{fun(_,_) -> a=b end,args}),
+ {ok,#{filters:=[_]}} = logger:get_primary_config(),
ok = logger:info(M1=?map_rep),
ok = check_logged(info,M1,#{}),
- {error,{not_found,lf}} = logger:remove_logger_filter(lf),
+ {error,{not_found,lf}} = logger:remove_primary_filter(lf),
- ok = logger:add_logger_filter(lf,{fun(_,_) -> faulty_return end,args}),
- {ok,#{filters:=[_]}} = logger:get_logger_config(),
+ ok = logger:add_primary_filter(lf,{fun(_,_) -> faulty_return end,args}),
+ {ok,#{filters:=[_]}} = logger:get_primary_config(),
ok = logger:info(M2=?map_rep),
ok = check_logged(info,M2,#{}),
- {error,{not_found,lf}} = logger:remove_logger_filter(lf),
+ {error,{not_found,lf}} = logger:remove_primary_filter(lf),
%% Handler filters
{error,{not_found,h0}} =
@@ -582,18 +582,18 @@ handler_failed(cleanup,_Config) ->
config_sanity_check(_Config) ->
%% Logger config
{error,{invalid_filter_default,bad}} =
- logger:set_logger_config(filter_default,bad),
- {error,{invalid_level,bad}} = logger:set_logger_config(level,bad),
- {error,{invalid_filters,bad}} = logger:set_logger_config(filters,bad),
- {error,{invalid_filter,bad}} = logger:set_logger_config(filters,[bad]),
+ logger:set_primary_config(filter_default,bad),
+ {error,{invalid_level,bad}} = logger:set_primary_config(level,bad),
+ {error,{invalid_filters,bad}} = logger:set_primary_config(filters,bad),
+ {error,{invalid_filter,bad}} = logger:set_primary_config(filters,[bad]),
{error,{invalid_filter,{_,_}}} =
- logger:set_logger_config(filters,[{id,bad}]),
+ logger:set_primary_config(filters,[{id,bad}]),
{error,{invalid_filter,{_,{_,_}}}} =
- logger:set_logger_config(filters,[{id,{bad,args}}]),
+ logger:set_primary_config(filters,[{id,{bad,args}}]),
{error,{invalid_filter,{_,{_,_}}}} =
- logger:set_logger_config(filters,[{id,{fun() -> ok end,args}}]),
- {error,{invalid_logger_config,{bad,bad}}} =
- logger:set_logger_config(bad,bad),
+ logger:set_primary_config(filters,[{id,{fun() -> ok end,args}}]),
+ {error,{invalid_primary_config,{bad,bad}}} =
+ logger:set_primary_config(bad,bad),
%% Handler config
{error,{not_found,h1}} = logger:set_handler_config(h1,a,b),
diff --git a/lib/kernel/test/logger_bench_SUITE.erl b/lib/kernel/test/logger_bench_SUITE.erl
index d47122ea9d..63fd4191af 100644
--- a/lib/kernel/test/logger_bench_SUITE.erl
+++ b/lib/kernel/test/logger_bench_SUITE.erl
@@ -181,16 +181,16 @@ log(Config) ->
log_drop(Config) ->
Times = ?TIMES*100,
- ok = logger:set_logger_config(level,error),
+ ok = logger:set_primary_config(level,error),
run_benchmark(Config,?FUNCTION_NAME,fun do_log_func/2, [info,?msg], Times).
log_drop(cleanup,_Config) ->
- ok = logger:set_logger_config(level,info).
+ ok = logger:set_primary_config(level,info).
log_drop_by_handler(Config) ->
Times = ?TIMES,
%% just ensure correct levels
- ok = logger:set_logger_config(level,info),
+ ok = logger:set_primary_config(level,info),
ok = logger:set_handler_config(?MODULE,level,error),
run_benchmark(Config,?FUNCTION_NAME,fun do_log_func/2, [info,?msg], Times).
@@ -209,16 +209,16 @@ macro(Config) ->
macro_drop(Config) ->
Times = ?TIMES*100,
- ok = logger:set_logger_config(level,error),
+ ok = logger:set_primary_config(level,error),
run_benchmark(Config,?FUNCTION_NAME,fun do_log_macro/2,[info,?msg], Times).
macro_drop(cleanup,_Config) ->
- ok = logger:set_logger_config(level,info).
+ ok = logger:set_primary_config(level,info).
macro_drop_by_handler(Config) ->
Times = ?TIMES,
%% just ensure correct levels
- ok = logger:set_logger_config(level,info),
+ ok = logger:set_primary_config(level,info),
ok = logger:set_handler_config(?MODULE,level,error),
run_benchmark(Config,?FUNCTION_NAME,fun do_log_macro/2, [info,?msg], Times).
@@ -237,16 +237,16 @@ error_logger(Config) ->
error_logger_drop(Config) ->
Times = ?TIMES*100,
- ok = logger:set_logger_config(level,error),
+ ok = logger:set_primary_config(level,error),
run_benchmark(Config,?FUNCTION_NAME,fun do_error_logger/2, [info,?msg], Times).
error_logger_drop(cleanup,_Config) ->
- ok = logger:set_logger_config(level,info).
+ ok = logger:set_primary_config(level,info).
error_logger_drop_by_handler(Config) ->
Times = ?TIMES,
%% just ensure correct levels
- ok = logger:set_logger_config(level,info),
+ ok = logger:set_primary_config(level,info),
ok = logger:set_handler_config(?MODULE,level,error),
run_benchmark(Config,?FUNCTION_NAME,fun do_log_func/2, [info,?msg], Times).
diff --git a/lib/kernel/test/logger_disk_log_h_SUITE.erl b/lib/kernel/test/logger_disk_log_h_SUITE.erl
index e1b1f16414..b2aa8fa51f 100644
--- a/lib/kernel/test/logger_disk_log_h_SUITE.erl
+++ b/lib/kernel/test/logger_disk_log_h_SUITE.erl
@@ -1323,7 +1323,7 @@ remove(Handler, LogName) ->
HState = #{log_names := Logs} = logger_disk_log_h:info(),
false = maps:is_key(LogName, HState),
false = lists:member(LogName, Logs),
- false = logger_config:exist(logger, LogName),
+ false = logger_config:exist(?LOGGER_TABLE, LogName),
{error,no_such_log} = disk_log:info(LogName),
ok.
diff --git a/lib/kernel/test/logger_env_var_SUITE.erl b/lib/kernel/test/logger_env_var_SUITE.erl
index f7f293c7fe..7ef6341377 100644
--- a/lib/kernel/test/logger_env_var_SUITE.erl
+++ b/lib/kernel/test/logger_env_var_SUITE.erl
@@ -125,14 +125,14 @@ error_logger_tty_sasl_compatible(Config) ->
ok.
error_logger_false(Config) ->
- {ok,#{handlers:=Hs,logger:=L},_Node} =
+ {ok,#{handlers:=Hs,primary:=P},_Node} =
setup(Config,
[{error_logger,false},
{logger_level,notice}]),
false = lists:keymember(?STANDARD_HANDLER,1,Hs),
{simple,logger_simple_h,SimpleC} = lists:keyfind(simple,1,Hs),
all = maps:get(level,SimpleC),
- notice = maps:get(level,L),
+ notice = maps:get(level,P),
SimpleFilters = maps:get(filters,SimpleC),
{domain,{_,{log,super,[otp,sasl]}}} = lists:keyfind(domain,1,SimpleFilters),
true = lists:keymember(stop_progress,1,SimpleFilters),
@@ -140,7 +140,7 @@ error_logger_false(Config) ->
ok.
error_logger_false_progress(Config) ->
- {ok,#{handlers:=Hs,logger:=L},_Node} =
+ {ok,#{handlers:=Hs,primary:=P},_Node} =
setup(Config,
[{error_logger,false},
{logger_level,notice},
@@ -148,7 +148,7 @@ error_logger_false_progress(Config) ->
false = lists:keymember(?STANDARD_HANDLER,1,Hs),
{simple,logger_simple_h,SimpleC} = lists:keyfind(simple,1,Hs),
all = maps:get(level,SimpleC),
- notice = maps:get(level,L),
+ notice = maps:get(level,P),
SimpleFilters = maps:get(filters,SimpleC),
{domain,{_,{log,super,[otp,sasl]}}} = lists:keyfind(domain,1,SimpleFilters),
false = lists:keymember(stop_progress,1,SimpleFilters),
@@ -156,7 +156,7 @@ error_logger_false_progress(Config) ->
ok.
error_logger_false_sasl_compatible(Config) ->
- {ok,#{handlers:=Hs,logger:=L},_Node} =
+ {ok,#{handlers:=Hs,primary:=P},_Node} =
setup(Config,
[{error_logger,false},
{logger_level,notice},
@@ -164,7 +164,7 @@ error_logger_false_sasl_compatible(Config) ->
false = lists:keymember(?STANDARD_HANDLER,1,Hs),
{simple,logger_simple_h,SimpleC} = lists:keyfind(simple,1,Hs),
all = maps:get(level,SimpleC),
- notice = maps:get(level,L),
+ notice = maps:get(level,P),
SimpleFilters = maps:get(filters,SimpleC),
{domain,{_,{log,super,[otp]}}} = lists:keyfind(domain,1,SimpleFilters),
false = lists:keymember(stop_progress,1,SimpleFilters),
@@ -328,7 +328,7 @@ logger_file_formatter(Config) ->
logger_filters(Config) ->
Log = file(Config,?FUNCTION_NAME),
- {ok,#{handlers:=Hs,logger:=Logger},Node}
+ {ok,#{handlers:=Hs,primary:=P},Node}
= setup(Config,
[{logger_progress_reports,log},
{logger,
@@ -347,14 +347,14 @@ logger_filters(Config) ->
false = lists:keymember(stop_progress,1,StdFilters),
false = lists:keymember(simple,1,Hs),
false = lists:keymember(sasl,1,Hs),
- LoggerFilters = maps:get(filters,Logger),
+ LoggerFilters = maps:get(filters,P),
true = lists:keymember(stop_progress,1,LoggerFilters),
ok.
logger_filters_stop(Config) ->
Log = file(Config,?FUNCTION_NAME),
- {ok,#{handlers:=Hs,logger:=Logger},Node}
+ {ok,#{handlers:=Hs,primary:=P},Node}
= setup(Config,
[{logger_progress_reports,log},
{logger,
@@ -373,7 +373,7 @@ logger_filters_stop(Config) ->
[] = maps:get(filters,StdC),
false = lists:keymember(simple,1,Hs),
false = lists:keymember(sasl,1,Hs),
- LoggerFilters = maps:get(filters,Logger),
+ LoggerFilters = maps:get(filters,P),
true = lists:keymember(log_error,1,LoggerFilters),
ok.
@@ -445,12 +445,12 @@ logger_disk_log_formatter(Config) ->
ok.
logger_undefined(Config) ->
- {ok,#{handlers:=Hs,logger:=L},_Node} =
+ {ok,#{handlers:=Hs,primary:=P},_Node} =
setup(Config,[{logger,[{handler,?STANDARD_HANDLER,undefined}]}]),
false = lists:keymember(?STANDARD_HANDLER,1,Hs),
{simple,logger_simple_h,SimpleC} = lists:keyfind(simple,1,Hs),
all = maps:get(level,SimpleC),
- info = maps:get(level,L),
+ info = maps:get(level,P),
SimpleFilters = maps:get(filters,SimpleC),
{domain,{_,{log,super,[otp,sasl]}}} = lists:keyfind(domain,1,SimpleFilters),
true = lists:keymember(stop_progress,1,SimpleFilters),