mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-08 03:47:57 -04:00
add Trace.with_setup_collector
This commit is contained in:
parent
dd432c4586
commit
67b3deb191
2 changed files with 9 additions and 0 deletions
|
|
@ -145,6 +145,10 @@ let shutdown () =
|
||||||
| C_none -> ()
|
| C_none -> ()
|
||||||
| C_some (st, cbs) -> cbs.shutdown st
|
| C_some (st, cbs) -> cbs.shutdown st
|
||||||
|
|
||||||
|
let with_setup_collector c f =
|
||||||
|
setup_collector c;
|
||||||
|
Fun.protect ~finally:shutdown f
|
||||||
|
|
||||||
type extension_event = Types.extension_event = ..
|
type extension_event = Types.extension_event = ..
|
||||||
|
|
||||||
let[@inline] extension_event ev : unit =
|
let[@inline] extension_event ev : unit =
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,11 @@ val shutdown : unit -> unit
|
||||||
(** [shutdown ()] shutdowns the current collector, if one was installed, and
|
(** [shutdown ()] shutdowns the current collector, if one was installed, and
|
||||||
waits for it to terminate before returning. *)
|
waits for it to terminate before returning. *)
|
||||||
|
|
||||||
|
val with_setup_collector : Collector.t -> (unit -> 'a) -> 'a
|
||||||
|
(** [with_setup_collector c f] installs [c], calls [f()], and shutdowns [c] once
|
||||||
|
[f()] is done.
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
(** {2 Extensions} *)
|
(** {2 Extensions} *)
|
||||||
|
|
||||||
type extension_event = Types.extension_event = ..
|
type extension_event = Types.extension_event = ..
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue