[pacman-dev] [PATCH] Color output from pm_vfprintf
This makes sure warning and error messages from _alpm_log are colored. Fixes FS#35160. Signed-off-by: Allan McRae <allan@archlinux.org> --- src/pacman/util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index 23eea98..05135d7 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1593,10 +1593,12 @@ int pm_vasprintf(char **string, alpm_loglevel_t level, const char *format, va_li /* print a prefix to the message */ switch(level) { case ALPM_LOG_ERROR: - pm_asprintf(string, _("error: %s"), msg); + pm_asprintf(string, "%s%s%s%s", config->colstr.err, _("error: "), + config->colstr.nocolor, msg); break; case ALPM_LOG_WARNING: - pm_asprintf(string, _("warning: %s"), msg); + pm_asprintf(string, "%s%s%s%s", config->colstr.warn, _("warning: "), + config->colstr.nocolor, msg); break; case ALPM_LOG_DEBUG: pm_asprintf(string, "debug: %s", msg); -- 1.8.4.2
It is pm_vasprintf that is changed... Commit messaged fixed on working branch. On 21/11/13 12:57, Allan McRae wrote:
This makes sure warning and error messages from _alpm_log are colored. Fixes FS#35160.
Signed-off-by: Allan McRae <allan@archlinux.org> --- src/pacman/util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/pacman/util.c b/src/pacman/util.c index 23eea98..05135d7 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1593,10 +1593,12 @@ int pm_vasprintf(char **string, alpm_loglevel_t level, const char *format, va_li /* print a prefix to the message */ switch(level) { case ALPM_LOG_ERROR: - pm_asprintf(string, _("error: %s"), msg); + pm_asprintf(string, "%s%s%s%s", config->colstr.err, _("error: "), + config->colstr.nocolor, msg); break; case ALPM_LOG_WARNING: - pm_asprintf(string, _("warning: %s"), msg); + pm_asprintf(string, "%s%s%s%s", config->colstr.warn, _("warning: "), + config->colstr.nocolor, msg); break; case ALPM_LOG_DEBUG: pm_asprintf(string, "debug: %s", msg);
participants (1)
-
Allan McRae