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

README.md.html

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