summaryrefslogtreecommitdiffstats
path: root/pym/elog_modules/mod_echo.py
blob: 55d33bb1f479b883a6f13f16df422a10ddee0f1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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:
		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