aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger_formatter.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-05-18 14:49:42 +0200
committerSiri Hansen <[email protected]>2018-05-23 11:11:13 +0200
commit4a055a655e1f82639b261689e56cbf2f1dc2d5c3 (patch)
tree96c14ebfdba8d8703dd8936e2f8f8318ed89c79f /lib/kernel/src/logger_formatter.erl
parentcfbe1afe6ba1f1083c8aa41c7aeb422f253f5d23 (diff)
downloadotp-4a055a655e1f82639b261689e56cbf2f1dc2d5c3.tar.gz
otp-4a055a655e1f82639b261689e56cbf2f1dc2d5c3.tar.bz2
otp-4a055a655e1f82639b261689e56cbf2f1dc2d5c3.zip
Allow chars_limit to limit strings
Earlier, only reports and {Format,Args} was limited by chars_limit, and max_size was needed to limit the size of a string.
Diffstat (limited to 'lib/kernel/src/logger_formatter.erl')
-rw-r--r--lib/kernel/src/logger_formatter.erl6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/kernel/src/logger_formatter.erl b/lib/kernel/src/logger_formatter.erl
index a19e7bbc73..5882c70ddf 100644
--- a/lib/kernel/src/logger_formatter.erl
+++ b/lib/kernel/src/logger_formatter.erl
@@ -85,8 +85,6 @@ format(#{level:=Level,msg:=Msg0,meta:=Meta},Config0)
do_format(Level,Msg,Data,[level|Format],Config) ->
[to_string(level,Level,Config)|do_format(Level,Msg,Data,Format,Config)];
-do_format(Level,Msg,Data,[msg|Format],Config) ->
- [Msg|do_format(Level,Msg,Data,Format,Config)];
do_format(Level,Msg,Data,[Key|Format],Config) when is_atom(Key); is_tuple(Key) ->
Value = value(Key,Data),
[to_string(Key,Value,Config)|do_format(Level,Msg,Data,Format,Config)];
@@ -130,9 +128,7 @@ to_string(X) ->
io_lib:format("~tp",[X]).
format_msg({string,Chardata},Meta,Config) ->
- try unicode:characters_to_list(Chardata)
- catch _:_ -> format_msg({"INVALID STRING: ~tp",[Chardata]},Meta,Config)
- end;
+ format_msg({"~ts",[Chardata]},Meta,Config);
format_msg({report,_}=Msg,Meta,#{report_cb:=Fun}=Config) when is_function(Fun,1) ->
format_msg(Msg,Meta#{report_cb=>Fun},maps:remove(report_cb,Config));
format_msg({report,Report},#{report_cb:=Fun}=Meta,Config) when is_function(Fun,1) ->