From: Rob Kinninmont Date: Thu, 30 Nov 2006 22:24:08 +0000 (-0700) Subject: update assertutil to use twisted log instead of amdlib Log X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~521 X-Git-Url: https://git.rkrishnan.org/%5B/frontends/-?a=commitdiff_plain;h=d328dd2ca47a03f7b305f01b70b1a180265f6903;p=tahoe-lafs%2Ftahoe-lafs.git update assertutil to use twisted log instead of amdlib Log --- diff --git a/amdlib/util/assertutil.py b/amdlib/util/assertutil.py index 368407d1..2adae8d6 100644 --- a/amdlib/util/assertutil.py +++ b/amdlib/util/assertutil.py @@ -11,7 +11,7 @@ Tests useful in assertion checking, prints out nicely formated messages too. from humanreadable import hr -import Log +from twisted.python import log def _assert(___cond=False, *___args, **___kwargs): if ___cond: @@ -48,10 +48,12 @@ def precondition(___cond=False, *___args, **___kwargs): msgbuf.append("%s: %s %s" % ((___kwargs.items()[0][0],) + tuple(map(hr, (___kwargs.items()[0][1], type(___kwargs.items()[0][1]),))))) msgbuf.extend([", %s: %s %s" % tuple(map(hr, (k, v, type(v),))) for k, v in ___kwargs.items()[1:]]) except Exception, le: - Log.Log(Log.ERR, 'assertutil', "INTERNAL ERROR IN pyutil.assertutil. %s %s %s" % (type(le), repr(le), le.args,)) + log.msg("assertutil.precondition(): INTERNAL ERROR IN pyutil.assertutil. %s %s %s" % (type(le), repr(le), le.args,)) + log.err() raise le except: - Log.Log(Log.ERR, 'assertutil', "INTERNAL ERROR IN pyutil.assertutil.") + log.msg("assertutil.precondition(): INTERNAL ERROR IN pyutil.assertutil.") + log.err() raise raise AssertionError, "".join(msgbuf)