package riot
An actor-model multi-core scheduler for OCaml 5
Install
Dune Dependency
Authors
Maintainers
Sources
riot-0.0.4.tbz
sha256=bd196369f74bbc42f23d262030d5fa04c03f5f00c46bf944f0dcbc193745976f
sha512=f1ca69e05b57e83a1bd173efe51b745d331355a83381e6068743a7626e45dcf515cdd8947180051bddfe9f5727c2732aa0f01a093b04cf33fa4081d32f24fd65
doc/src/riot.lib/logger_app.ml.html
Source file logger_app.ml
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
open Runtime include Logger module Formatter = struct type Message.t += Log of log [@@unboxed] let stdout = Format.make_formatter (output_substring stdout) (fun () -> flush stdout) let rec formatter_loop config = match receive () with | Log { message; ts; src = sch, pid; level; ns } -> let pp_now = Ptime.pp_rfc3339 ~frac_s:5 ~space:true ~tz_offset_s:0 () in let ns_str = match ns with [] -> "" | _ -> String.concat "." ns ^ "::" in if config.color_output then Format.fprintf stdout "%s" (Level.to_color_string level); if config.print_time then Format.fprintf stdout "%a " pp_now ts; if config.print_source then Format.fprintf stdout "[thread=%a,pid=%a] " Scheduler_uid.pp sch Pid.pp pid; Format.fprintf stdout "[%s%a] %s\x1b[0m\n%!" ns_str Level.pp level message; formatter_loop config | _ -> formatter_loop config let start_link config = let pid = spawn_link (fun () -> formatter_loop config) in set_on_log (fun log -> send pid (Log log)); Ok pid let child_spec config = Supervisor.child_spec ~start_link config end let name = "Riot.Logger" let default_opts = { print_time = false; print_source = false; color_output = true } let start () = let child_specs = [ Formatter.child_spec default_opts ] in let (Ok pid) = Supervisor.start_link ~child_specs () in Ok pid [@@warning "-8"]
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>