A simple ppx to remove some boilerplate when using the excelent Logs library.
Add this to your dune stanza for your executable
(preprocess
(pps logs-ppx))
and make sure that the logs
library has also been added to the libraries
field, e.g.,
(library
(name foo)
(libraries logs))
Then you use it like this in OCaml:
(* Convention to avoid name clashes *)
module Log = Logs
[%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"));
A huge thanks goes to @davesnx for a lot of help and his starter repo