[Pkg-libvirt-commits] [libguestfs] 68/179: v2v: Add an 'info' function for info messages, and use it for virtio message.
Hilko Bengen
bengen at moszumanska.debian.org
Fri Oct 31 19:08:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit 2ba45489a1e296b89d3c32ef80e57efc13f32a88
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Mon Oct 13 11:39:24 2014 +0200
v2v: Add an 'info' function for info messages, and use it for virtio message.
---
mllib/common_utils.ml | 12 ++++++++++++
mllib/common_utils.mli | 3 +++
v2v/v2v.ml | 4 ++--
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index ba39b70..adfad3f 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -212,6 +212,8 @@ let ansi_red ?(chan = stdout) () =
if TTY.isatty_stdout () then output_string chan "\x1b[1;31m"
let ansi_blue ?(chan = stdout) () =
if TTY.isatty_stdout () then output_string chan "\x1b[1;34m"
+let ansi_magenta ?(chan = stdout) () =
+ if TTY.isatty_stdout () then output_string chan "\x1b[1;35m"
let ansi_restore ?(chan = stdout) () =
if TTY.isatty_stdout () then output_string chan "\x1b[0m"
@@ -258,6 +260,16 @@ let warning ~prog fs =
in
ksprintf display fs
+let info ~prog fs =
+ let display str =
+ let chan = stdout in
+ ansi_magenta ~chan ();
+ wrap ~chan (sprintf (f_"%s: %s") prog str);
+ ansi_restore ~chan ();
+ print_newline ();
+ in
+ ksprintf display fs
+
(* All the OCaml virt-* programs use this wrapper to catch exceptions
* and print them nicely.
*)
diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
index 71ccb4c..d78fd70 100644
--- a/mllib/common_utils.mli
+++ b/mllib/common_utils.mli
@@ -66,6 +66,9 @@ val error : prog:string -> ?exit_code:int -> ('a, unit, string, 'b) format4 -> '
val warning : prog:string -> ('a, unit, string, unit) format4 -> 'a
(** Standard warning function. *)
+val info : prog:string -> ('a, unit, string, unit) format4 -> 'a
+(** Standard info function. Note: Use full sentences for this. *)
+
val run_main_and_handle_errors : prog:string -> (unit -> unit) -> unit
(** Common function for handling pretty-printing exceptions. *)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index d78b26c..a87fb1d 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -251,9 +251,9 @@ let rec main () =
(* Did we manage to install virtio drivers? *)
if not quiet then (
if guestcaps.gcaps_block_bus = Virtio_blk then
- printf (f_"This guest has virtio drivers installed.\n%!")
+ info ~prog (f_"This guest has virtio drivers installed.")
else
- printf (f_"This guest does not have virtio drivers installed.\n%!");
+ info ~prog (f_"This guest does not have virtio drivers installed.");
);
g#umount_all ();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list