Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/kernel/src/logger_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ get(Tid) ->
Configs = ets:match(Tid, {{?HANDLER_KEY, '_'}, '$1'}),
lists:flatten(Configs).

get(Tid, primary) ->
case persistent_term:get({?MODULE, table_key(primary), conf}, undefined) of
undefined ->
[{_, Config}] = ets:lookup(Tid, table_key(primary)),
ok = persistent_term:put({?MODULE, table_key(primary), conf}, Config),
{ok, Config};
Config ->
{ok, Config}
end;

get(Tid,What) ->
case ets:lookup(Tid,table_key(What)) of
[{_,Config}] ->
Expand Down Expand Up @@ -133,6 +143,7 @@ set(Tid,What,Config) ->
ok = persistent_term:put({?MODULE,table_key(What)}, LevelInt),
case What of
primary ->
ok = persistent_term:put({?MODULE, table_key(What), conf}, Config),
%% If we change primary level, then we need to flush
%% the module level cache.
[persistent_term:put(Key,?PRIMARY_TO_CACHE(LevelInt))
Expand Down
Loading