package logs-ppx

  1. Overview
  2. Docs
PPX to cut down on boilerplate when using Logs

Install

Dune Dependency

Authors

Maintainers

Sources

logs-ppx-v0.1.0.tbz
sha256=f379990778301d9d1d1e8b3f8a5f6b8d7361147d89034b0c6a42dabb0a33d425
sha512=500bbbc91f588850376e8a337664702c0d12d06152d1b193bdc24c86ac0a28a7013dc50697eafe7ad7aa4e9942f96b6279bf17d8da0c0b81a4fe53fd0ebf507d

Description

PPX to remove the closure when logging with Logs. The PPX will still generate the closure which keeps the nice properties of the Logs library.

Published: 08 Dec 2020

README

logs-ppx

A simple ppx to remove some boilerplate when using the excelent Logs library.

Usage

Add this to your dune stanza for your executable

(preprocess
  (pps logs-ppx))

Then you use it like this in OCaml:

[%log debug "Hello %s!" "world"]
(* Which genrates the following *)
Logs.debug (fun m -> m "Hello %s!" "world")

And in Reason it looks like this:

[%log debug("Hello %s!", "world")];
// Which generates the following
Logs.debug(m => m("Hello %s!", "world"));

Thanks

A huge thanks goes to @davesnx for a lot of help and his starter repo

Dependencies (3)

  1. ppxlib
  2. dune >= "2.6"
  3. ocaml >= "4.08.0"

Dev Dependencies (3)

  1. reason with-test & >= "3.0.0" & < "4.0.0"
  2. ocaml-migrate-parsetree with-test & >= "1.7.3" & < "2.0.0"
  3. logs with-test

Used by

None

Conflicts

None