[ANN] ppx_minidebug 1.3.0: toward a logging framework

Hi! I’m happy to invite you to take a look at ppx_minidebug 1.3.0. It’s now available in the opam repository. Some new features since version 1.0:

  • Extension point variants that support debug runtime passing, they simplify having e.g. dedicated log files for threads or domains.
  • Unregistered extension points %log, %log_result, %log_printbox to explicitly log values.
  • Log levels at runtime to restrict how much is logged, and at compile time to restrict how much logging code is generated.
    • Log levels can be both set globally and adjusted for local scopes.
    • Compile time log levels can be read off an environment variable.
  • Extension point prefix %diagn_ (joining prefixes %debug_ and %track_) that restricts the log level to explicit logs.
  • Does not crash for logs that escaped all log entries – prints the entry id of the entry the orphaned log lexically belongs to.
    • Optionally prints log entry ids for all entries.
  • Optionally snapshots unclosed log trees:
    • outputs the current log tree if sufficient time passed since the previous tree was printed or the previous snapshot, erases the previous snapshot when snapshotting or printing the same log tree.
  • A few more changes that improve usability.

P.S. If you face problems with missing line breaks in the HTML output, re-install printbox from source or version > 0.10.0.

8 Likes

Happy to say ppx_minidebug 1.4.0 is now in the opam repository. The two new features since 1.3.0 are:

  • a Table of Contents view on logs, a log file with selected log entry headers as hyperlinks pointing to anchors in the regular log file(s), the table of contents logs preserve the log tree hierarchy but don’t use folding,
  • time stamps optionally output as time elapsed since the start of a program rather than as wall-clock times.

What future development of ppx_minidebug would you like to see?

  • I want flame graphs
  • I want better support for exceptions
  • I want %log_entry (release 1.5.0 already)
  • ppx_minidebug is already good enough for me
  • ppx_minidebug is not for me anyway
0 voters

Thank You!

Happy to announce ppx_minidebug 1.5.0. It should soon propagate to the opam repository. Two new features since 1.4.0:

  • [%log_entry header_string; body...] syntax to explicitly create log subtrees without polluting with source location information. Note that if you want the source location you could always do let _for_debug : type... = body... in....
  • Minimalistic flame graphs. Example:

    (Note that the output is very configurable, e.g. by default the at elapsed time information is not printed.)
4 Likes