dbuenzli / logs

Logging infrastructure for OCaml
http://erratique.ch/software/logs
ISC License
86 stars 19 forks source link

Consider supplying pp_level for convenience #9

Closed edwintorok closed 8 years ago

edwintorok commented 8 years ago

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

dbuenzli commented 8 years ago

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 ?

edwintorok commented 8 years ago

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)

dbuenzli commented 8 years ago

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