8000 GitHub - anchpop/logs-ppx
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

anchpop/logs-ppx

 
 

Repository files navigation

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))

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"));

Thanks

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Nix 48.3%
  • OCaml 30.2%
  • Shell 13.6%
  • JavaScript 7.9%
0