package pplumbing
Module LogSource
include module type of struct include Pplumbing_log.Log end
Logs types aliases
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!"
]
])
;;Source
type log =
?header:string ->
?tags:(unit -> Logs.Tag.set) ->
(unit -> Pplumbing_pp_tty.Pp_tty.t list) ->
unit