package pplumbing

  1. Overview
  2. Docs
Utility libraries to use with [pp]

Install

dune-project
 Dependency

Authors

Maintainers

Sources

pplumbing-0.0.16.tbz
sha256=8ae0c09fec9088bc7af60582717a9e9d8bb7703e2fbf0a1b90b82e5962ed7039
sha512=ddd1d5a3d47e7c5ebfb2898f0810156dfca4e10df500ce8f39238cfe02b51fd12ea6d7796914bd02e9ad8e615da1ed7067c9f712bdbbfb884cab08d57bba3564

doc/pplumbing.log/Log/index.html

Module LogSource

include module type of struct include Pplumbing_log.Log end

Logs types aliases

Sourcetype level = Logs.level
Sourcetype src = Logs.src

Logging functions

Log interface

We've looked through sherlocode to get some sense of how the Logs interface is used. In the most common cases, the function m is applied directly without header nor tags. When the headers or tags are used, they are usually constant values for headers, and for tags, either a constant or a function from unit to tags, applied in the body of m.

Based on this remarks and on the fact that we don't need a format string anymore, we've proposed an interface where the m auxiliary function is removed.

We this interface, the previous example can be written as:

  let hello ?src ?header ?tags () =
    Log.info ?src ?header ?tags (fun () ->
      [ Pp.concat
          ~sep:Pp.space
          [ Pp.text "Hello"
          ; Pp_tty.tag (Ansi_styles [ `Fg_blue ]) (Pp.verbatim "Colored")
          ; Pp.text "World!"
          ]
      ])
  ;;
Sourcetype log = ?header:string -> ?tags:(unit -> Logs.Tag.set) -> (unit -> Pplumbing_pp_tty.Pp_tty.t list) -> unit
Sourceval msg : ?src:src -> level -> log
Sourceval app : ?src:src -> log
Sourceval err : ?src:src -> log
Sourceval warn : ?src:src -> log
Sourceval info : ?src:src -> log
Sourceval debug : ?src:src -> log

Logs Interface