aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-05-14 19:06:22 +0200
committerLukas Larsson <[email protected]>2018-05-21 17:43:53 +0200
commitd29fca17a0c053fca2e5961fb146e9aeefb55aa9 (patch)
treeeb6b00cb523b9d2ab1c3bfc180f22f55de6e9492 /lib/kernel/src/logger.erl
parentc2c5e22e0c0f67d0c445113b7908dd07e4e8d4c4 (diff)
downloadotp-d29fca17a0c053fca2e5961fb146e9aeefb55aa9.tar.gz
otp-d29fca17a0c053fca2e5961fb146e9aeefb55aa9.tar.bz2
otp-d29fca17a0c053fca2e5961fb146e9aeefb55aa9.zip
Hide handlers field in logger config map from the API
This field contains the index of all installed handlers. It is internal and can not be altered by the user, and should therefore not be visible.
Diffstat (limited to 'lib/kernel/src/logger.erl')
-rw-r--r--lib/kernel/src/logger.erl17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl
index 7ce4a80bbd..2c7466fdf6 100644
--- a/lib/kernel/src/logger.erl
+++ b/lib/kernel/src/logger.erl
@@ -364,7 +364,8 @@ set_handler_config(HandlerId,Config) ->
-spec get_logger_config() -> {ok,Config} when
Config :: config().
get_logger_config() ->
- logger_config:get(?LOGGER_TABLE,logger).
+ {ok,Config} = logger_config:get(?LOGGER_TABLE,logger),
+ {ok,maps:remove(handlers,Config)}.
-spec get_handler_config(HandlerId) -> {ok,{Module,Config}} | {error,term()} when
HandlerId :: handler_id(),
@@ -445,8 +446,9 @@ i() ->
i(_Action = print) ->
io:put_chars(i(string));
i(_Action = string) ->
- #{logger := #{level := Level, handlers := Handlers,
- filters := Filters, filter_default := FilterDefault},
+ #{logger := #{level := Level,
+ filters := Filters,
+ filter_default := FilterDefault},
handlers := HandlerConfigs,
module_levels := Modules} = i(term),
[io_lib:format("Current logger configuration:~n", []),
@@ -455,16 +457,15 @@ i(_Action = string) ->
io_lib:format(" Filters: ~n", []),
print_filters(4, Filters),
io_lib:format(" Handlers: ~n", []),
- print_handlers([C || {Id, _, _} = C <- HandlerConfigs,
- lists:member(Id, Handlers)]),
+ print_handlers(HandlerConfigs),
io_lib:format(" Level set per module: ~n", []),
print_module_levels(Modules)
];
i(_Action = term) ->
{Logger, Handlers, Modules} = logger_config:get(tid()),
- #{logger=>Logger,
- handlers=>Handlers,
- module_levels=>Modules}.
+ #{logger=>maps:remove(handlers,Logger),
+ handlers=>lists:keysort(1,Handlers),
+ module_levels=>lists:keysort(1,Modules)}.
print_filters(Indent, {Id, {Fun, Config}}) ->
io_lib:format("~sId: ~p~n"