mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-07 18:37:56 -05:00
fix tef-tldrs
This commit is contained in:
parent
dc37f68993
commit
e2a942fedc
3 changed files with 5 additions and 21 deletions
|
|
@ -2,10 +2,4 @@
|
|||
(name trace_tef_tldrs)
|
||||
(public_name trace-tef.tldrs)
|
||||
(synopsis "Multiprocess tracing using the `tldrs` daemon")
|
||||
(libraries
|
||||
trace.core
|
||||
trace.private.util
|
||||
trace.subscriber
|
||||
trace-tef
|
||||
unix
|
||||
threads))
|
||||
(libraries trace.core trace.util trace-tef unix threads))
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ let find_role ~out () : role =
|
|||
| Some path -> Some (write_to_file path)
|
||||
| None -> None))
|
||||
|
||||
let subscriber_ (client : as_client) : Trace_subscriber.t =
|
||||
let collector_ (client : as_client) : Collector.t =
|
||||
(* connect to unix socket *)
|
||||
let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in
|
||||
(try Unix.connect sock (Unix.ADDR_UNIX client.socket)
|
||||
|
|
@ -106,19 +106,13 @@ let subscriber_ (client : as_client) : Trace_subscriber.t =
|
|||
(fun file -> fpf out "EMIT_TEF_AT_EXIT %s\n" file)
|
||||
client.emit_tef_at_exit;
|
||||
|
||||
Trace_tef.Private_.subscriber_jsonl ~finally ~out:(`Output out) ()
|
||||
|
||||
let subscriber ~out () =
|
||||
let role = find_role ~out () in
|
||||
match role with
|
||||
| None -> assert false
|
||||
| Some c -> subscriber_ c
|
||||
Trace_tef.Private_.collector_jsonl ~finally ~out:(`Output out) ()
|
||||
|
||||
let collector ~out () : collector =
|
||||
let role = find_role ~out () in
|
||||
match role with
|
||||
| None -> assert false
|
||||
| Some c -> subscriber_ c |> Trace_subscriber.collector
|
||||
| Some c -> collector_ c
|
||||
|
||||
open struct
|
||||
let register_atexit =
|
||||
|
|
@ -136,7 +130,7 @@ let setup ?(out = `Env) () =
|
|||
| None -> ()
|
||||
| Some c ->
|
||||
register_atexit ();
|
||||
Trace_core.setup_collector @@ Trace_subscriber.collector @@ subscriber_ c
|
||||
Trace_core.setup_collector @@ collector_ c
|
||||
|
||||
let with_setup ?out () f =
|
||||
setup ?out ();
|
||||
|
|
|
|||
|
|
@ -5,10 +5,6 @@ val collector : out:[ `File of string ] -> unit -> Trace_core.collector
|
|||
(** Make a collector that writes into the given output. See {!setup} for more
|
||||
details. *)
|
||||
|
||||
val subscriber : out:[ `File of string ] -> unit -> Trace_subscriber.t
|
||||
(** Make a subscriber that writes into the given output.
|
||||
@since 0.8 *)
|
||||
|
||||
type output = [ `File of string ]
|
||||
(** Output for tracing.
|
||||
- [`File "foo"] will enable tracing and print events into file named "foo".
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue