Skip to content

Commit ddb5fc7

Browse files
committed
Fix up io_server trace docs
1 parent 87a6de3 commit ddb5fc7

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ erl_crash.dump
1414
/doc/stylesheet.css
1515
/site/*.html
1616
.rebar/
17+
_build/
18+

rebar.lock

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[].

src/recon_trace.erl

+10-9
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,19 @@
154154
%%% so tracing is automatically turned off once you disconnect.
155155
%%%
156156
%%% If sending output to the Group Leader is not desired, you may specify
157-
%%% a different pid() via the option `output' in the {@link calls/3} function.
157+
%%% a different pid() via the option `io_server' in the {@link calls/3} function.
158158
%%% For instance to write the traces to a file you can do something like
159159
%%%
160160
%%% 1> {ok, Dev} = file:open("/tmp/trace",[write]).
161-
%%% 2> recon_trace:calls({queue, in, fun(_) -> return_trace() end}, 3, [{output, Dev}]).
161+
%%% 2> recon_trace:calls({queue, in, fun(_) -> return_trace() end}, 3, [{io_server, Dev}]).
162162
%%% 1
163163
%%% 3>
164164
%%% Recon tracer rate limit tripped.
165165
%%% 4> file:close(Dev).
166166
%%%
167167
%%% The only output still sent to the Group Leader is the rate limit being
168-
%%% tripped, and any errors.
168+
%%% tripped, and any errors. The rest will be sent to the other IO
169+
%%% server (see [http://erlang.org/doc/apps/stdlib/io_protocol.html]).
169170
%%% @end
170171
-module(recon_trace).
171172

@@ -191,7 +192,7 @@
191192
| {args, args | arity} % default: args
192193
%% match pattern options
193194
| {scope, global | local} % default: global
194-
| {output, pid()} % default: group_leader()
195+
| {io_server, pid()} % default: group_leader()
195196
].
196197

197198
-type mod() :: '_' | module().
@@ -366,16 +367,16 @@ formatter(Tracer, Parent, Ref, FormatterFun, IOServer) ->
366367
Parent ! {Ref, linked},
367368
formatter(Tracer, IOServer, FormatterFun).
368369

369-
formatter(Tracer, Leader, FormatterFun) ->
370+
formatter(Tracer, IOServer, FormatterFun) ->
370371
receive
371372
{'EXIT', Tracer, normal} ->
372373
io:format("Recon tracer rate limit tripped.~n"),
373374
exit(normal);
374375
{'EXIT', Tracer, Reason} ->
375376
exit(Reason);
376377
TraceMsg ->
377-
io:format(Leader, FormatterFun(TraceMsg), []),
378-
formatter(Tracer, Leader, FormatterFun)
378+
io:format(IOServer, FormatterFun(TraceMsg), []),
379+
formatter(Tracer, IOServer, FormatterFun)
379380
end.
380381

381382

@@ -385,12 +386,12 @@ formatter(Tracer, Leader, FormatterFun) ->
385386

386387
%% starts the tracer and formatter processes, and
387388
%% cleans them up before each call.
388-
setup(TracerFun, TracerArgs, FormatterFun, OutputTo) ->
389+
setup(TracerFun, TracerArgs, FormatterFun, IOServer) ->
389390
clear(),
390391
Ref = make_ref(),
391392
Tracer = spawn_link(?MODULE, TracerFun, TracerArgs),
392393
register(recon_trace_tracer, Tracer),
393-
Format = spawn(?MODULE, formatter, [Tracer, self(), Ref, FormatterFun, OutputTo]),
394+
Format = spawn(?MODULE, formatter, [Tracer, self(), Ref, FormatterFun, IOServer]),
394395
register(recon_trace_formatter, Format),
395396
receive
396397
{Ref, linked} -> Tracer

0 commit comments

Comments
 (0)