Color output from pm_vasprintf

This makes sure warning and error messages from _alpm_log are colored.
Fixes FS#35160.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2013-11-21 12:55:39 +10:00
parent 9749fb033c
commit b847d1d8e7

View file

@ -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);