add new echo module for people who don't want any real logging (trunk r6458)
authorZac Medico <zmedico@gentoo.org>
Thu, 21 Jun 2007 05:00:59 +0000 (05:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 21 Jun 2007 05:00:59 +0000 (05:00 -0000)
svn path=/main/branches/2.1.2/; revision=6899

cnf/make.conf
pym/elog_modules/mod_echo.py [new file with mode: 0644]

index 15d54da063ae6c4e39ac52518f2d6edcc11cb578..5c2b8a5da1bd139f119bfd69ddfa4cdf4b8f63aa 100644 (file)
@@ -333,6 +333,7 @@ PORTAGE_ELOG_CLASSES="warn error log"
 
 # PORTAGE_ELOG_SYSTEM: selects the module(s) to process the log messages. Modules
 #                      included in portage are (empty means logging is disabled):
+#                          echo (display messages again when emerge exits)
 #                          save (saves one log per package in $PORT_LOGDIR/elog, 
 #                                /var/log/portage/elog if $PORT_LOGDIR is unset)
 #                          custom (passes all messages to $PORTAGE_ELOG_COMMAND)
diff --git a/pym/elog_modules/mod_echo.py b/pym/elog_modules/mod_echo.py
new file mode 100644 (file)
index 0000000..a120d17
--- /dev/null
@@ -0,0 +1,30 @@
+# elog_modules/mod_echo.py - elog dispatch module
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+from output import EOutput
+from portage_const import EBUILD_PHASES
+
+_items = {}
+def process(mysettings, key, logentries, fulltext):
+       _items[key] = logentries
+
+def finalize(mysettings):
+       printer = EOutput()
+       for key in _items.keys():
+               print
+               printer.einfo("Messages for package %s:" % key)
+               print
+               for phase in EBUILD_PHASES:
+                       if not phase in _items[key]:
+                               continue
+                       for msgtype, msgcontent in _items[key][phase]:
+                               fmap = {"INFO": printer.einfo,
+                                               "WARN": printer.ewarn,
+                                               "ERROR": printer.eerror,
+                                               "LOG": printer.einfo,
+                                               "QA": printer.ewarn}
+                               for line in msgcontent:
+                                       fmap[msgtype](line.strip("\n"))
+       return