aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-05-22 13:22:55 +0200
committerSiri Hansen <[email protected]>2018-05-23 12:50:55 +0200
commit53539ee751da408029c9dfae80384fdec6c7a552 (patch)
tree7a9d516ca9d0678dd37748dd010fa62ff05df322 /lib/kernel/src
parent72f1ce276401e0b8de9c0c527cbc324da0186939 (diff)
downloadotp-53539ee751da408029c9dfae80384fdec6c7a552.tar.gz
otp-53539ee751da408029c9dfae80384fdec6c7a552.tar.bz2
otp-53539ee751da408029c9dfae80384fdec6c7a552.zip
Update documentation of logger and error_logger
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) ->