[pacman-dev] [PATCH 09/16] colourize warnings and errors
Simon Gomizelj
simongmzlj at gmail.com
Fri Mar 1 16:32:38 EST 2013
Signed-off-by: Simon Gomizelj <simongmzlj at gmail.com>
---
src/pacman/conf.c | 4 ++++
src/pacman/conf.h | 2 ++
src/pacman/util.c | 4 ++--
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 34b4199..de0df76 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -65,10 +65,14 @@ static void init_colors(int colors)
if(colors == PM_COLOR_ON) {
colstr.colon = BOLDBLUE "::" BOLDWHITE;
colstr.title = BOLDWHITE;
+ colstr.warn = BOLDYELLOW;
+ colstr.err = BOLDRED;
colstr.nc = NC;
} else {
colstr.colon = "::";
colstr.title = "";
+ colstr.warn = "",
+ colstr.err = "",
colstr.nc = "";
}
}
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 9207c6d..0b015ef 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -103,6 +103,8 @@ typedef struct __config_t {
typedef struct __colstr_t {
const char *colon;
const char *title;
+ const char *warn;
+ const char *err;
const char *nc;
} colstr_t;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 1cd955e..19ac795 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1661,10 +1661,10 @@ int pm_vfprintf(FILE *stream, alpm_loglevel_t level, const char *format, va_list
/* print a prefix to the message */
switch(level) {
case ALPM_LOG_ERROR:
- fprintf(stream, _("error: "));
+ fprintf(stream, "%s%s%s", colstr.err, _("error: "), colstr.nc);
break;
case ALPM_LOG_WARNING:
- fprintf(stream, _("warning: "));
+ fprintf(stream, "%s%s%s", colstr.warn, _("warning: "), colstr.nc);
break;
case ALPM_LOG_DEBUG:
fprintf(stream, "debug: ");
--
1.8.1.4
More information about the pacman-dev
mailing list