package nloge

  1. Overview
  2. Docs
Non-blocking logger with eio

Install

Dune Dependency

Authors

Maintainers

Sources

nloge-0.0.1.tbz
sha256=168cbaec19a6de1771c54ffe76c225aa938f92e5aaef0143bc66a81ba098ff90
sha512=543563d09ac4ec244680c0029ef9412a88f95fdcb3362f26083a54a0ebe4d2783e150b25f63ece80ed3869636961cb36eb3756abef14a11f6be58ecd4acb6e9a

Description

Published: 17 May 2023

README

n log e

Nloge, no-blocking logger with eio

Logger emits JSON -{Emit} -> converts JSON to string -{Write}-> "log"s the string

Usage

See hello

let () =
  Eio_main.run
  @@ fun env ->
  Eio.Switch.run
  @@ fun sw ->
  Nloge.run ~sw ~outputs:[ env#stdout ] ~level:`Debug
  @@ fun () ->
  Nloge.debug
    ~__LOC__
    ~metadata:[ "now_posix", `Float (Eio.Time.now env#clock) ]
    (fun m -> m "hello")
;;

By default nloge logs with JSON format:

$ dune exec --display=quiet examples/hello.exe
{"log_level":"DEBUG","message":"hello","label":"File \"examples/hello.ml\", line 9, characters 5-12","now_posix":1683056241.957986}

custom writere

See custom writer

Dependencies (5)

  1. ptime
  2. yojson >= "1.6.0"
  3. ppx_deriving
  4. eio < "0.12"
  5. dune >= "3.7.0"

Dev Dependencies (4)

  1. odoc with-doc
  2. alcotest with-test
  3. ppx_expect with-test
  4. eio_main with-test

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.