dbuenzli / logs

Logging infrastructure for OCaml

Home Page:http://erratique.ch/software/logs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider supplying pp_level for convenience

edwintorok opened this issue · comments

When writing your own reporter it would be helpful if there was a reusable pp_level that takes a function that maps a level to message,color pairs and returns a level Fmt.t

Note sure exactly what you want here, I could provide a

pp_header : (string option * level) Fmt.t 

in Logs_stdo (not in Logs because the latter doesn't depend on Fmt) that captures the coloured printing of "[$header]".

Is this what you were thinking about ?

On 01/06/2016 10:40 PM, Daniel Bünzli wrote:

Note sure exactly what you want here, I could provide a

pp_header : (string option * level) Fmt.t

in |Logs_stdo| (not in |Logs| because the latter doesn't depend on |Fmt|) that captures the coloured printing of |"[$header]"|.

Is this what you were thinking about ?

Yes.
(there is already a Logs.Src.pp and Tags.pp_set, so it is nice to have pp_header for consistency so that all the arguments of the reporter are pretty printable)

Ok I'll add a non-coloured version to Logs and a possibly colored one to Logs_stdo.