Skip to content
Browse files

Adding example of how to use ejsLog to overview.edoc

  • Loading branch information...
1 parent 6fc9f33 commit 5640ac31fc31f75af9210f45d14f9a2b63345710 Kevin Smith committed Jan 23, 2010
Showing with 8 additions and 0 deletions.
  1. +8 −0 overview.edoc
View
8 overview.edoc
@@ -42,3 +42,11 @@ js:call(Port, <<"constant_mult">>, [5]).
js:call(Port, <<"constant_mult">>, [5], [{<<"my_constant">>, 200}]).
{ok, 1000}
</pre>
+<h4>Using ejsLog to debug</h4>
+<pre>
+JS = &lt;&lt;"function my_add(x, y) { ejsLog(\"/tmp/foo.txt\", \"Hello, world!\"); return x + y; }"&gt;&gt;.
+ok = js:define(Port, JS).
+%% Logging output is automatically timestamped and written to /tmp/foo.txt
+%% when the function runs
+{ok, 84} = js:call(Port, &lt;&lt;"my_add"&gt;&gt;, [42, 42]).
+</pre>

0 comments on commit 5640ac3

Please sign in to comment.
Something went wrong with that request. Please try again.