[jhbuild] Capture logging output in the tinderbox output (GNOME bug 654466)
- From: Craig Keogh <cskeogh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] Capture logging output in the tinderbox output (GNOME bug 654466)
- Date: Mon, 1 Aug 2011 11:57:06 +0000 (UTC)
commit 0b1c973fccf580662d840f1d3552cead28675f47
Author: Craig Keogh <cskeogh adam com au>
Date: Mon Jul 25 22:47:43 2011 +0930
Capture logging output in the tinderbox output (GNOME bug 654466)
jhbuild/frontends/tinderbox.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/frontends/tinderbox.py b/jhbuild/frontends/tinderbox.py
index 6f25fc3..8cabc7c 100644
--- a/jhbuild/frontends/tinderbox.py
+++ b/jhbuild/frontends/tinderbox.py
@@ -21,6 +21,7 @@ import os
import time
import subprocess
import locale
+import logging
import codecs
import sys
@@ -155,6 +156,11 @@ def escape(string):
'\t',' ')
return string
+class LoggingFormatter(logging.Formatter):
+ def __init__(self):
+ logging.Formatter.__init__(self, '<div class="%(levelname)s">'
+ '%(message)s</div>')
+
class TinderboxBuildScript(buildscript.BuildScript):
help_url = 'http://live.gnome.org/JhbuildIssues/'
triedcheckout = None
@@ -164,6 +170,9 @@ class TinderboxBuildScript(buildscript.BuildScript):
self.indexfp = None
self.modulefp = None
+ for handle in logging.getLogger().handlers:
+ handle.setFormatter(LoggingFormatter())
+
self.outputdir = os.path.abspath(config.tinderbox_outputdir)
if not os.path.exists(self.outputdir):
os.makedirs(self.outputdir)
@@ -330,6 +339,11 @@ class TinderboxBuildScript(buildscript.BuildScript):
self.modulefp = codecs.open(
os.path.join(self.outputdir, self.modulefilename), 'w',
encoding=self.charset, errors='xmlcharrefreplace')
+
+ for handle in logging.getLogger().handlers:
+ if isinstance(handle, logging.StreamHandler):
+ handle.stream = self.modulefp
+
self.modulefp.write(buildlog_header % { 'module': module,
'charset': self.charset })
def end_module(self, module, failed):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]