diff options
author | Siri Hansen <[email protected]> | 2018-06-05 20:03:21 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2018-06-08 14:45:56 +0200 |
commit | 35c311607ed5b5a9ddea8c9a9be7c3b41845c737 (patch) | |
tree | 82a7e9ce68b267363ad391acc18fbac9bb4ea697 /lib/kernel/src/logger_config.erl | |
parent | 6f753ccf5178a809a7a26f692249bdfb5985335e (diff) | |
download | otp-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
Diffstat (limited to 'lib/kernel/src/logger_config.erl')
-rw-r--r-- | lib/kernel/src/logger_config.erl | 14 |
1 files changed, 7 insertions, 7 deletions
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}. |