aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/logger_formatter_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-07-13 12:23:01 +0200
committerSiri Hansen <[email protected]>2018-07-13 12:23:01 +0200
commit6ff0857f6385848248f38e6315881f6ffc44729f (patch)
tree56e63d6888873877b3858cd2a6ff6566c7510220 /lib/kernel/test/logger_formatter_SUITE.erl
parentadb0b077e7ee5b0d9b140bb985b56a43d82927cd (diff)
parent48824be3d833b13a35b92652df372c6ce3c190a0 (diff)
downloadotp-6ff0857f6385848248f38e6315881f6ffc44729f.tar.gz
otp-6ff0857f6385848248f38e6315881f6ffc44729f.tar.bz2
otp-6ff0857f6385848248f38e6315881f6ffc44729f.zip
Merge branch 'siri/logger/post-21/OTP-15132' into maint
* siri/logger/post-21/OTP-15132: [logger] Allow setting kernel parameter 'logger_level' to 'all' [kernel] Reduce risk of dead lock when terminating logger_sup [logger] Fix regexp replacement for unicode strings Update proc_lib:report_cb to obey logger formatter's size limiting params [logger] Allow report callback with two arguments returning a string Don't call report_cb from cth_log_redirect - formatter does that Add legacy test of sasl_report_file_h and size limiting [logger] Remove compiler warnings in test [logger] Fix problem with test cases waiting for handler restart [logger] Add ?LOG macro which takes Level as argument [logger] Improve spec for set_handler_config/3 and set_primary_config/2 [logger] Generate .png file from .dia [logger] Update documentation
Diffstat (limited to 'lib/kernel/test/logger_formatter_SUITE.erl')
-rw-r--r--lib/kernel/test/logger_formatter_SUITE.erl44
1 files changed, 32 insertions, 12 deletions
diff --git a/lib/kernel/test/logger_formatter_SUITE.erl b/lib/kernel/test/logger_formatter_SUITE.erl
index 8fe8d5199b..aa8dc42691 100644
--- a/lib/kernel/test/logger_formatter_SUITE.erl
+++ b/lib/kernel/test/logger_formatter_SUITE.erl
@@ -312,30 +312,48 @@ format_msg(_Config) ->
#{report_cb=>fun(_)-> faulty_return end},
#{template=>Template}),
ct:log(String5),
- "REPORT_CB ERROR: term; Returned: faulty_return" = String5,
+ "REPORT_CB/1 ERROR: term; Returned: faulty_return" = String5,
String6 = format(info,{report,term},
#{report_cb=>fun(_)-> erlang:error(fun_crashed) end},
#{template=>Template}),
ct:log(String6),
- "REPORT_CB CRASH: term; Reason: {error,fun_crashed}" = String6,
+ "REPORT_CB/1 CRASH: term; Reason: {error,fun_crashed,"++_ = String6,
+
+ String7 = format(info,{report,term},
+ #{report_cb=>fun(_,_)-> ['not',a,string] end},
+ #{template=>Template}),
+ ct:log(String7),
+ "REPORT_CB/2 ERROR: term; Returned: ['not',a,string]" = String7,
+
+ String8 = format(info,{report,term},
+ #{report_cb=>fun(_,_)-> faulty_return end},
+ #{template=>Template}),
+ ct:log(String8),
+ "REPORT_CB/2 ERROR: term; Returned: faulty_return" = String8,
+
+ String9 = format(info,{report,term},
+ #{report_cb=>fun(_,_)-> erlang:error(fun_crashed) end},
+ #{template=>Template}),
+ ct:log(String9),
+ "REPORT_CB/2 CRASH: term; Reason: {error,fun_crashed,"++_ = String9,
%% strings are not formatted
- String7 = format(info,{string,"string"},
+ String10 = format(info,{string,"string"},
#{report_cb=>fun(_)-> {"formatted",[]} end},
#{template=>Template}),
- ct:log(String7),
- "string" = String7,
+ ct:log(String10),
+ "string" = String10,
- String8 = format(info,{string,['not',printable,list]},
+ String11 = format(info,{string,['not',printable,list]},
#{report_cb=>fun(_)-> {"formatted",[]} end},
#{template=>Template}),
- ct:log("~ts",[String8]), % avoiding ct_log crash
- "FORMAT ERROR: \"~ts\" - [['not',printable,list]]" = String8,
+ ct:log("~ts",[String11]), % avoiding ct_log crash
+ "FORMAT ERROR: \"~ts\" - [['not',printable,list]]" = String11,
- String9 = format(info,{string,"string"},#{},#{template=>Template}),
- ct:log(String9),
- "string" = String9,
+ String12 = format(info,{string,"string"},#{},#{template=>Template}),
+ ct:log(String12),
+ "string" = String12,
ok.
@@ -639,8 +657,10 @@ check_config(_Config) ->
?cfgerr({max_size,bad}) =
logger_formatter:check_config(#{max_size => bad}),
+ ok =
+ logger_formatter:check_config(#{report_cb => fun(_,_) -> "" end}),
?cfgerr({report_cb,F}) =
- logger_formatter:check_config(#{report_cb => F=fun(_,_) -> {"",[]} end}),
+ logger_formatter:check_config(#{report_cb => F=fun(_,_,_) -> {"",[]} end}),
?cfgerr({report_cb,bad}) =
logger_formatter:check_config(#{report_cb => bad}),