summaryrefslogtreecommitdiffstats
path: root/pym/portage/elog/filtering.py
blob: d834edd3aaa740001e5ea61b39ce3ed74d1404bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# elog/messages.py - elog core functions
# Copyright 2006-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

from portage.const import EBUILD_PHASES

def filter_loglevels(logentries, loglevels):
	# remove unwanted entries from all logentries
	rValue = {}
	loglevels = [x.upper() for x in loglevels]
	for phase in logentries:
		for msgtype, msgcontent in logentries[phase]:
			if msgtype.upper() in loglevels or "*" in loglevels:
				if phase not in rValue:
					rValue[phase] = []
				rValue[phase].append((msgtype, msgcontent))
	return rValue