From: Zac Medico Date: Thu, 29 Nov 2007 09:35:01 +0000 (-0000) Subject: Make elog_process() pre-load log modules that it can be called X-Git-Tag: v2.2_pre1~273 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7533586dcc2c0351da28da56b9e6a2a1b9ea004d;p=portage.git Make elog_process() pre-load log modules that it can be called just for that purpose. svn path=/main/trunk/; revision=8751 --- diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index c68fedca0..d3e333534 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -46,6 +46,27 @@ _elog_mod_imports = {} _elog_atexit_handlers = [] _preserve_logentries = {} def elog_process(cpv, mysettings, phasefilter=None): + + global _elog_mod_imports + logsystems = mysettings.get("PORTAGE_ELOG_SYSTEM","").split() + for s in logsystems: + # allow per module overrides of PORTAGE_ELOG_CLASSES + if ":" in s: + s, levels = s.split(":", 1) + levels = levels.split(",") + # - is nicer than _ for module names, so allow people to use it. + s = s.replace("-", "_") + try: + name = "portage.elog.mod_" + s + m = _elog_mod_imports.get(name) + if m is None: + m = __import__(name) + for comp in name.split(".")[1:]: + m = getattr(m, comp) + _elog_mod_imports[name] = m + except ImportError: + pass + ebuild_logentries = collect_ebuild_messages(os.path.join(mysettings["T"], "logging")) all_logentries = collect_messages() if all_logentries.has_key(cpv):