package logs-ppx

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

Install

Dune Dependency

Authors

Maintainers

Sources

logs-ppx-0.2.0.tbz
sha256=053f043ef959d6dc079503eab482e91ac1509685d393c4b51f6991c210c0bfb1
sha512=15f5d2f88305bf26c653500f2c883e4774039b2b34a8f7cda3c4e6ae3dcc21939981a23d787e9a89a869c0bd76d0299cdcce2db548df108296f754e8c1584cd3

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: 06 Apr 2021

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.8.0"

Dev Dependencies (1)

  1. logs with-test

Used by (1)

  1. um-abt

Conflicts

None

OCaml

Innovation. Community. Security.