package logs
Logging infrastructure for OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
logs-0.9.0.tbz
sha512=b75fb28e83f33461b06b5c9b60972c4a9a9a1599d637b4a0c7b1e86a87f34fe5361e817cb31f42ad7e7cbb822473b28fab9f58a02870eb189ebe88dae8e045ff
doc/src/logs.browser/logs_browser.ml.html
Source file logs_browser.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
(*--------------------------------------------------------------------------- Copyright (c) 2015 The logs programmers. All rights reserved. SPDX-License-Identifier: ISC ---------------------------------------------------------------------------*) (* Console reporter *) open Jsoo_runtime let console_obj = Js.pure_js_expr "console" let console : Logs.level -> string -> unit = fun level s -> let meth = match level with | Logs.Error -> "error" | Logs.Warning -> "warn" | Logs.Info -> "info" | Logs.Debug -> "debug" | Logs.App -> "log" in ignore (Js.meth_call console_obj meth [| Js.string s |]) let ppf, flush = let b = Buffer.create 255 in let flush () = let s = Buffer.contents b in Buffer.clear b; s in Format.formatter_of_buffer b, flush let console_report src level ~over k msgf = let k _ = console level (flush ()); over (); k () in msgf @@ fun ?header ? fmt -> match header with | None -> Format.kfprintf k ppf ("@[" ^^ fmt ^^ "@]@.") | Some h -> Format.kfprintf k ppf ("[%s] @[" ^^ fmt ^^ "@]@.") h let console_reporter () = { Logs.report = console_report }
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>