From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1PorWl-0004yZ-0R for garchives@archives.gentoo.org; Mon, 14 Feb 2011 06:03:15 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AB421E08FB; Mon, 14 Feb 2011 06:00:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 679CAE08E9 for ; Mon, 14 Feb 2011 06:00:25 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9C93E1B41F2 for ; Mon, 14 Feb 2011 06:00:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id AC97980075 for ; Mon, 14 Feb 2011 06:00:23 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/debug.py X-VCS-Directories: layman/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: c387c4eff9eb13ece3108cf1b5818d0ba6551f1f Date: Mon, 14 Feb 2011 06:00:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 5199ce706e82aafea1c86542ccc3d8f4 commit: c387c4eff9eb13ece3108cf1b5818d0ba6551f1f Author: Brian Dolbec gmail com> AuthorDate: Wed Jul 7 01:07:41 2010 +0000 Commit: Brian Dolbec gmail com> CommitDate: Fri Feb 11 10:46:04 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/layman.git;a=3D= commit;h=3Dc387c4ef Add an output parameter to Message class and change the prints that weren= 't already re-directed to re-direct to it --- layman/debug.py | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/layman/debug.py b/layman/debug.py index 41d084c..e5a5d61 100644 --- a/layman/debug.py +++ b/layman/debug.py @@ -44,6 +44,7 @@ class Message: # next time. =20 def __init__(self, module =3D '', + out =3D sys.stdout, err =3D sys.stderr, dbg =3D sys.stderr, debugging_level =3D 4, @@ -54,6 +55,7 @@ class Message: mth =3D None, obj =3D None, var =3D None): + if mth =3D=3D None: mth =3D ['*'] if obj =3D=3D None: obj =3D ['*'] if var =3D=3D None: var =3D ['*'] @@ -67,6 +69,9 @@ class Message: # Where should the error output go? This can also be a file self.error_out =3D err =20 + # Where should the normal output go? This can also be a file + self.std_out =3D out + # The higher the level the more information you will get self.warn_lev =3D warn_level =20 @@ -298,7 +303,7 @@ class Message: ## Output Functions =20 def notice (self, note): - print note + print >> self.std_out, note =20 def info (self, info, level =3D 4): =20 @@ -309,7 +314,7 @@ class Message: return =20 for i in info.split('\n'): - print self.maybe_color('green', '* ') + i + print >> self.std_out, self.maybe_color('green', '* ') + i =20 def status (self, message, status, info =3D 'ignored'): =20 @@ -322,7 +327,7 @@ class Message: return =20 for i in lines[0:-1]: - print self.maybe_color('green', '* ') + i + print >> self.std_out, self.maybe_color('green', '* ') + i =20 i =3D lines[-1] =20 @@ -336,7 +341,7 @@ class Message: else: result =3D '[' + self.maybe_color('yellow', info) + ']' =20 - print self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - le= n(i)) \ + print >> self.std_out, self.maybe_color('green', '* ') + i + ' = ' + '.' * (58 - len(i)) \ + ' ' + result =20 def warn (self, warn, level =3D 4): @@ -348,7 +353,7 @@ class Message: return =20 for i in warn.split('\n'): - print self.maybe_color('yellow', '* ') + i + print >> self.std_out, self.maybe_color('yellow', '* ') + i =20 def error (self, error): =20