Re: [Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)
Closed #225. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/225#event-1174860161___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)
Reopened #225. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/225#event-1174860166___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)
Let's try to reopen and see if CI passes. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/225#issuecomment-317177017___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)
proyvind 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)) which he already did, I now notice :p -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/225#discussion_r119919458___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)
proyvind 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)) I only commited as-is to a separate branch to make PR from without testing as a favour to @n3npq, unless he attends to, I'll probably get to it eventually.. ;) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/225#discussion_r119895426___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)
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: https://github.com/rpm-software-management/rpm/pull/225#discussion_r119872437___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)
ignatenkobrain 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)) I would prefer to have some macro/option to force enabling/disabling colors (like a --color[=WHEN] where WHEN is "auto", "always", "never")... because when you would be passing that to `less`, you could pass `-R` and it will show you colors in pager... Quite useful. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/225#pullrequestreview-41716172___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] Colorized rpmlog() output (jbj, #198) (#225)
Here's a pull request of what posted by @n3npq Jeff in #198. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/225 -- Commit Summary -- * Colorized rpmlog() output (jbj, #198) -- File Changes -- M rpmio/rpmlog.c (148) -- Patch Links -- https://github.com/rpm-software-management/rpm/pull/225.patch https://github.com/rpm-software-management/rpm/pull/225.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/225 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint