[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 04/12] libqos/qgraph: add qos_dump_graph()
From: |
Eric Blake |
Subject: |
Re: [PATCH v4 04/12] libqos/qgraph: add qos_dump_graph() |
Date: |
Wed, 28 Oct 2020 08:00:21 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 |
On 10/28/20 12:51 AM, Thomas Huth wrote:
>>>> +#define GREEN(txt) ( \
>>>> + "\033[0;92m" txt \
>>>> + "\033[0m" \
>>>> +)
>>>
>>> I don't think this is very portable - and it will only make logs ugly to
>>> read in text editors. Could you please simply drop these macros?
>>>
> Sure, colored output is nice, but we certainly also need a way to disable
> it, e.g. if you want to collect the log in a file and then have a look at it
> in a text editor.
Agreed. GNU libtextstyle
(https://www.gnu.org/software/gettext/libtextstyle/manual/libtextstyle.html)
is a much more portable way to do colored output where it becomes easy
to enable/disable or even adjust the colors to user preferences. Sadly,
it is GPLv3+, and thus unusable for qemu. But the bare minimum that you
must have when making colored output gated on whether stdout is a
terminal (that is, any program that does color should have a
--color=off|auto|on command-line option, and that in turn implies
function calls rather than macros to properly encapsulate the decision
logic.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[PATCH v4 05/12] tests/qtest/qos-test: dump qos graph if verbose, Christian Schoenebeck, 2020/10/08
[PATCH v4 06/12] tests/qtest/qos-test: dump environment variables if verbose, Christian Schoenebeck, 2020/10/08
[PATCH v4 07/12] tests/qtest/qos-test: dump QEMU command if verbose, Christian Schoenebeck, 2020/10/08
[PATCH v4 08/12] tests/9pfs: change qtest name prefix to synth, Christian Schoenebeck, 2020/10/08