aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/logger.erl4
-rw-r--r--lib/kernel/src/logger_formatter.erl21
2 files changed, 15 insertions, 10 deletions
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl
index 12f8dd77cf..3beb3102fa 100644
--- a/lib/kernel/src/logger.erl
+++ b/lib/kernel/src/logger.erl
@@ -81,7 +81,9 @@
mfa => {module(),atom(),non_neg_integer()},
file => file:filename(),
line => non_neg_integer(),
- term() => term()}.
+ domain => [atom()],
+ report_cb => fun((report()) -> {io:format(),[term()]}),
+ atom() => term()}.
-type location() :: #{mfa := {module(),atom(),non_neg_integer()},
file := file:filename(),
line := non_neg_integer()}.
diff --git a/lib/kernel/src/logger_formatter.erl b/lib/kernel/src/logger_formatter.erl
index 95cb6e35fc..4d727b3da0 100644
--- a/lib/kernel/src/logger_formatter.erl
+++ b/lib/kernel/src/logger_formatter.erl
@@ -26,21 +26,22 @@
%%%-----------------------------------------------------------------
%%% Types
+-type config() :: #{chars_limit=>pos_integer()| unlimited,
+ depth=>pos_integer() | unlimited,
+ legacy_header=>boolean(),
+ max_size=>pos_integer() | unlimited,
+ report_cb=>fun((logger:report()) -> {io:format(),[term()]}),
+ single_line=>boolean(),
+ template=>template(),
+ time_designator=>byte(),
+ time_offset=>integer()|[byte()]}.
-type template() :: [atom()|tuple()|string()].
%%%-----------------------------------------------------------------
%%% API
-spec format(LogEvent,Config) -> unicode:chardata() when
LogEvent :: logger:log_event(),
- Config :: #{single_line=>boolean(),
- legacy_header=>boolean(),
- report_cb=>fun((logger:report()) -> {io:format(),[term()]}),
- chars_limit=>pos_integer()| unlimited,
- max_size=>pos_integer() | unlimited,
- depth=>pos_integer() | unlimited,
- template=>template(),
- time_designator=>byte(),
- time_offset=>integer()|[byte()]}.
+ Config :: config().
format(#{level:=Level,msg:=Msg0,meta:=Meta},Config0)
when is_map(Config0) ->
Config = add_default_config(Config0),
@@ -322,6 +323,8 @@ offset_to_utc([$+|Tz]) ->
offset_to_utc(_) ->
false.
+-spec check_config(Config) -> ok | {error,term()} when
+ Config :: config().
check_config(Config) when is_map(Config) ->
do_check_config(maps:to_list(Config));
check_config(Config) ->