Add format character for process exit traces

When receiving an 'EXIT' or 'DOWN' message the Reason term can now be
formatted by couch_log using a "~r" format character.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/commit/038586b7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/tree/038586b7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/diff/038586b7

Branch: refs/heads/master
Commit: 038586b7ab6cfec1b15f44162eddb5723803be21
Parents: b6eca22
Author: Paul J. Davis <paul.joseph.da...@gmail.com>
Authored: Mon Jul 25 12:26:49 2016 -0500
Committer: Paul J. Davis <paul.joseph.da...@gmail.com>
Committed: Mon Jul 25 12:26:49 2016 -0500

----------------------------------------------------------------------
 src/couch_log_trunc_io_fmt.erl | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/blob/038586b7/src/couch_log_trunc_io_fmt.erl
----------------------------------------------------------------------
diff --git a/src/couch_log_trunc_io_fmt.erl b/src/couch_log_trunc_io_fmt.erl
index 7f3ba37..77f0b2e 100644
--- a/src/couch_log_trunc_io_fmt.erl
+++ b/src/couch_log_trunc_io_fmt.erl
@@ -121,6 +121,7 @@ collect_cc([$p|Fmt], [A|Args]) -> {$p,[A],Fmt,Args};
 collect_cc([$W|Fmt], [A,Depth|Args]) -> {$W,[A,Depth],Fmt,Args};
 collect_cc([$P|Fmt], [A,Depth|Args]) -> {$P,[A,Depth],Fmt,Args};
 collect_cc([$s|Fmt], [A|Args]) -> {$s,[A],Fmt,Args};
+collect_cc([$r|Fmt], [A|Args]) -> {$r,[A],Fmt,Args};
 collect_cc([$e|Fmt], [A|Args]) -> {$e,[A],Fmt,Args};
 collect_cc([$f|Fmt], [A|Args]) -> {$f,[A],Fmt,Args};
 collect_cc([$g|Fmt], [A|Args]) -> {$g,[A],Fmt,Args};
@@ -254,6 +255,10 @@ control2($s, [L0], F, Adj, P, Pad, latin1, L) ->
 control2($s, [L0], F, Adj, P, Pad, unicode, L) ->
     List = couch_log_trunc_io:fprint(cdata_to_chars(L0), L, [{force_strings, 
true}]),
     Res = uniconv(string(List, F, Adj, P, Pad)),
+    {Res, lists:flatlength(Res)};
+control2($r, [R], F, Adj, P, Pad, _Enc, _L) ->
+    List = couch_log_formatter:format_reason(R),
+    Res = string(List, F, Adj, P, Pad),
     {Res, lists:flatlength(Res)}.
 
 iolist_to_chars([C|Cs]) when is_integer(C), C >= $\000, C =< $\377 ->

Reply via email to