package pplumbing

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

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