aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger_formatter.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-05-09 17:22:43 +0200
committerLukas Larsson <[email protected]>2018-05-21 17:43:53 +0200
commitbfe8a57bb9356415e6438f0deb410b03a7c602d1 (patch)
tree2d3ace36d9a0d5858f8c861ff5499e4dc1685431 /lib/kernel/src/logger_formatter.erl
parent92d93f85e88235f3fa757d300628d382d09c6226 (diff)
downloadotp-bfe8a57bb9356415e6438f0deb410b03a7c602d1.tar.gz
otp-bfe8a57bb9356415e6438f0deb410b03a7c602d1.tar.bz2
otp-bfe8a57bb9356415e6438f0deb410b03a7c602d1.zip
Remove logger env vars for format_depth, max_size and utc
These are replaced by new config handling and must not be used any more.
Diffstat (limited to 'lib/kernel/src/logger_formatter.erl')
-rw-r--r--lib/kernel/src/logger_formatter.erl29
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/kernel/src/logger_formatter.erl b/lib/kernel/src/logger_formatter.erl
index 8e954f8d98..624f523465 100644
--- a/lib/kernel/src/logger_formatter.erl
+++ b/lib/kernel/src/logger_formatter.erl
@@ -259,17 +259,17 @@ month(12) -> "Dec".
utcstr(#{utc:=true}) -> "UTC ";
utcstr(_) -> "".
-add_default_config(#{utc:=_}=Config0) ->
+add_default_config(Config0) ->
Default =
#{legacy_header=>false,
single_line=>true,
chars_limit=>unlimited},
MaxSize = get_max_size(maps:get(max_size,Config0,false)),
Depth = get_depth(maps:get(depth,Config0,false)),
+ Utc = get_utc(maps:get(utc,Config0,false)),
add_default_template(maps:merge(Default,Config0#{max_size=>MaxSize,
- depth=>Depth}));
-add_default_config(Config) ->
- add_default_config(Config#{utc=>logger:get_utc_config()}).
+ depth=>Depth,
+ utc=>Utc})).
add_default_template(#{template:=_}=Config) ->
Config;
@@ -284,11 +284,28 @@ default_template(_) ->
?DEFAULT_FORMAT_TEMPLATE.
get_max_size(false) ->
- logger:get_max_size();
+ unlimited;
get_max_size(S) ->
max(10,S).
get_depth(false) ->
- logger:get_format_depth();
+ error_logger:get_format_depth();
get_depth(S) ->
max(5,S).
+
+get_utc(false) ->
+ get_utc_config();
+get_utc(U) ->
+ U.
+
+get_utc_config() ->
+ %% SASL utc_log overrides stdlib config - in order to have uniform
+ %% timestamps in log messages
+ case application:get_env(sasl, utc_log) of
+ {ok, Val} -> Val;
+ undefined ->
+ case application:get_env(stdlib, utc_log) of
+ {ok, Val} -> Val;
+ undefined -> false
+ end
+ end.