module Logs_fmt:sig
..end
Format
reporter for Logs
.
Reports message using two formatters. One for Logs.App
level message and the other one for the other levels.
Release 0.5.0 - Daniel Bünzli <daniel.buenzl i@erratique.ch>
val reporter : ?prefix:string option ->
?app:Format.formatter -> ?dst:Format.formatter -> unit -> Logs.reporter
reporter ~prefix ~app ~dst ()
is a reporter that reports Logs.App
level messages on app
(defaults to Format.std_formatter
) and
all other levels on dst
(defaults to Format.err_formatter
).
If prefix
is Some pre
messages on dst
are prefixed by pre
which is
recommended if you are doing a simple command line tool defaults to:
Some (Printf.sprintf "%s: " @@ Filename.basename Sys.executable_name)
The reporter does not process or render information about
message sources or tags.
ANSI colors will be used in the output if the formatters are
configured to do so, see Fmt.set_style_renderer
and
Fmt_tty
. Consult a full setup example.
Important. This is a synchronous reporter it considers the log
operation to be over once the message was formatted and before
calling the continuation (see the note on synchronous
logging). In particular if the formatters are baked by channels,
it will block until the message has been formatted on the channel
before proceeding which may not be suitable in a cooperative
concurrency setting like Lwt
.
val err_style : Fmt.style
err_style
is the style used to render headers at error level.val warn_style : Fmt.style
warn_style
is the style used to render headers at warning level.val info_style : Fmt.style
info_style
is the style used to render headers at info level.val debug_style : Fmt.style
debug_style
is the style used to render headers at debug level.val pp_header : Format.formatter -> Logs.level * string option -> unit
pp_header
is like Logs.pp_header
but may use ANSI colors if the
formatter is configured to do so, see Fmt.set_style_renderer
and
Fmt_tty
.