diff options
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/doc/src/error_logger.xml | 15 | ||||
-rw-r--r-- | lib/kernel/src/error_logger.erl | 8 |
2 files changed, 19 insertions, 4 deletions
diff --git a/lib/kernel/doc/src/error_logger.xml b/lib/kernel/doc/src/error_logger.xml index 814e8eac46..27db00819f 100644 --- a/lib/kernel/doc/src/error_logger.xml +++ b/lib/kernel/doc/src/error_logger.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2016</year> + <year>1996</year><year>2017</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -163,6 +163,19 @@ ok</pre> </desc> </func> <func> + <name name="get_format_depth" arity="0"/> + <fsummary>Get the value of the Kernel application variable + <c>error_logger_format_depth</c>.</fsummary> + <desc> + <p>Returns <c>max(10, Depth)</c>, where <c>Depth</c> is the + value of + <seealso marker="kernel:kernel_app#error_logger_format_depth"> + error_logger_format_depth</seealso> + in the Kernel application, if Depth is an integer. Otherwise, + <c>unlimited</c> is returned.</p> + </desc> + </func> + <func> <name name="info_msg" arity="1"/> <name name="info_msg" arity="2"/> <fsummary>Send a standard information event to the error logger.</fsummary> diff --git a/lib/kernel/src/error_logger.erl b/lib/kernel/src/error_logger.erl index 93a3f4f2e5..9bf8547745 100644 --- a/lib/kernel/src/error_logger.erl +++ b/lib/kernel/src/error_logger.erl @@ -31,7 +31,7 @@ handle_event/2, handle_call/2, handle_info/2, terminate/2]). --export([limit_term/1]). +-export([get_format_depth/0, limit_term/1]). -define(buffer_size, 10). @@ -524,12 +524,14 @@ string_p1(_) -> false. -spec limit_term(term()) -> term(). limit_term(Term) -> - case get_depth() of + case get_format_depth() of unlimited -> Term; D -> io_lib:limit_term(Term, D) end. -get_depth() -> +-spec get_format_depth() -> 'unlimited' | pos_integer(). + +get_format_depth() -> case application:get_env(kernel, error_logger_format_depth) of {ok, Depth} when is_integer(Depth) -> max(10, Depth); |