1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
# Setting up the environment
```ocaml
# #require "eio_main";;
# open Eio.Std;;
```
## Overriding tracing
```ocaml
# Eio_main.run @@ fun env ->
let debug = Eio.Stdenv.debug env in
let my_traceln = {
Eio.Debug.traceln = fun ?__POS__:_ fmt -> Fmt.epr ("++" ^^ fmt ^^ "@.")
} in
Fiber.both
(fun () ->
Fiber.with_binding debug#traceln my_traceln @@ fun () ->
Fiber.both
(fun () -> traceln "a")
(fun () -> Fiber.yield (); traceln "b")
)
(fun () -> traceln "c");;
++a
+c
++b
- : unit = ()
```
|