package ppx_log

  1. Overview
  2. Docs
Ppx_sexp_message-like extension nodes for lazily rendering log messages

Install

Dune Dependency

Authors

Maintainers

Sources

ppx_log-v0.16.0.tar.gz
sha256=94d92ab27d5f1e4e50d269d23e33e6819a4a1a613fe0312f59201e3c1d74faf8

Description

Part of the Jane Street's PPX rewriters collection.

Published: 02 Jun 2023

README

ppx_log

A ppx rewriter that defines extension nodes for logging: primarily useful to avoid the allocation of sexps that will never be logged.

[%log.debug log "example log" (content : Content.t)]
[%log.global.debug "example log" (content : Content.t)]

How to add to your project

You can simply open Async in the files that you want to log with Async.Log. Additionally, open Async.Ppx_log_syntax.No_global will prevent you from using Log.Global if you want to avoid the global log.

ppx_log can add source code position to each logged message, configurable at a library level by the -log-source-position switch:

(preprocess (pps (ppx_jane ... -log-source-position)))

Finally [%log.debug] to your heart's content!

Tests and examples

Take a look at the mdx file for tested examples.

Dependencies (8)

  1. ppxlib >= "0.28.0"
  2. dune >= "2.0.0"
  3. sexplib >= "v0.16" & < "v0.17"
  4. ppx_sexp_message >= "v0.16" & < "v0.17"
  5. ppx_sexp_conv >= "v0.16" & < "v0.17"
  6. ppx_here >= "v0.16" & < "v0.17"
  7. base >= "v0.16" & < "v0.17"
  8. ocaml >= "4.14.0"

Dev Dependencies

None

Used by (2)

  1. async = "v0.16.0"
  2. ppx_jane = "v0.16.0"

Conflicts

None

OCaml

Innovation. Community. Security.