[Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)

Jeff Johnson notifications at github.com
Fri Jun 2 14:35:57 UTC 2017

n3npq commented on this pull request.

> @@ -237,6 +237,89 @@ const char * rpmlogLevelPrefix(rpmlogLvl pri)
     return prefix;
+static const char * rpmlogLevelColor(rpmlogLvl pri)
+    return rpmlogMsgPrefixColor[pri&0x7];
+static int rpmlogDefault(FILE *stdlog, rpmlogRec rec)
+    static const char fubar[] =
+	"Error occurred during writing of a log message";
+    FILE *msgout = (stdlog ? stdlog : stderr);
+    const char * colorOn = isatty(fileno(msgout))

RPM output is often useless in a pager because of inconsistent usage between stdout/stderr while logging. Complicated operations (-Uvh, -ba) that run many scripts cannot colorize without applying patterns using sed.

So adding a --color=WHEN option (instead of a simple colorization of the the log prefix) is likely not worth the effort.

BTW, adding comments after C statements, not in the midst of a statement, provides better context. The snippet above appears to be coercing an integer return into a const char * pointer.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20170602/38667d8b/attachment.html>

More information about the Rpm-maint mailing list