Anonymous avatar Anonymous committed f6c39e2

describe new trace logger automatic "escaping" of funs and pids

Comments (0)

Files changed (1)

 The format should be such that a {{{ file:consult/1 }}} will give you a list of the lines as erlang terms.
-== Troubleshooting the Trace Utility ==
+== Special Handling for Funs and Pids ==
-The trace utility currently has trouble if any of your resources return a {{{ fun }}}, because of the way they serialize in the log file.  If you see errors in your webmachine log like:
+Funs and Pids don't roundtrip through file serialization very well ({{{file:consult/1}}} will blow up on a fun or pid written to a file with {{{io:format("~p", [FunOrPid])}}}).  To deal with this, the trace logger prints a recognizable tuple translation instead of the fun or pid.
+=== Fun Translation ===
+Funs you might see in Erlang source as {{{ fun io:format/2 }}} will appear in a trace log as:
-{error,{badmatch,{error,{597,erl_parse,["syntax error before: ",["Fun"]]}}},
-       [{wmtrace_resource,produce_html,2},
+                        {name,format},
+                        {arity,2},
+                        {type,external}]}
-when trying to get to the trace utility, you need to clean up those funs in your log file.  A simple way to do it is to run this command at a prompt in your traces directory:
+Those that would be in Erlang source as {{{ fun() -> ok end }}} will appear in a trace log as:
-for x in *.wmtrace; do sed "s/#Fun<.*>/wmtrace_anonymous_function_todo/" $x > $x-fixed; done
+                        {name,'-to_html/2-fun-0-'},
+                        {arity,0},
+                        {type,local}]}
-Anywhere you would have seen a {{{ fun }}}, you'll now see {{{ wmtrace_anonymous_function_todo }}}.
+=== Pid Translation ===
+Pids are simply logged in a marked tuple, after being run through {{{ erlang:pid_to_list/1 }}}:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.