Client: add Cli_entries.warning to log a message on stderr without raising exception

This commit is contained in:
Guillem Rieu 2016-11-22 17:24:52 +01:00 committed by Benjamin Canou
parent 087a097cf7
commit 80e1b0f312
2 changed files with 6 additions and 0 deletions

View File

@ -361,6 +361,11 @@ let error fmt=
Lwt.fail (Failure msg)) Lwt.fail (Failure msg))
fmt fmt
let warning fmt =
Format.kasprintf
(fun msg -> log "stderr" msg)
fmt
let message fmt = let message fmt =
Format.kasprintf Format.kasprintf
(fun msg -> log "stdout" msg) (fun msg -> log "stdout" msg)

View File

@ -68,6 +68,7 @@ val dispatch:
val log_hook : (string -> string -> unit Lwt.t) option ref val log_hook : (string -> string -> unit Lwt.t) option ref
val error : ('a, Format.formatter, unit, 'b Lwt.t) format4 -> 'a val error : ('a, Format.formatter, unit, 'b Lwt.t) format4 -> 'a
val warning : ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
val message : ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a val message : ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
val answer : ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a val answer : ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
val log : string -> ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a val log : string -> ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a