From: Brian Warner Date: Sat, 20 Sep 2008 17:34:27 +0000 (-0700) Subject: util.log: send log.err to Twisted too, so that Trial tests are flunked X-Git-Url: https://git.rkrishnan.org/simplejson/%22news.html/install.html?a=commitdiff_plain;h=8854d0c1b59f2f75abe310288fb56bc304e4bac7;p=tahoe-lafs%2Ftahoe-lafs.git util.log: send log.err to Twisted too, so that Trial tests are flunked --- diff --git a/src/allmydata/util/log.py b/src/allmydata/util/log.py index c5faa9b1..d8fb0786 100644 --- a/src/allmydata/util/log.py +++ b/src/allmydata/util/log.py @@ -1,5 +1,6 @@ from foolscap.logging import log +from twisted.python import log as tw_log NOISY = log.NOISY # 10 OPERATIONAL = log.OPERATIONAL # 20 @@ -13,8 +14,13 @@ BAD = log.BAD # 40 msg = log.msg +# If log.err() happens during a unit test, the unit test should fail. We +# accomplish this by sending it to twisted.log too. When a WEIRD/SCARY/BAD +# thing happens that is nevertheless handled, use log.msg(failure=f, +# level=WEIRD) instead. + def err(*args, **kwargs): - # this should probably be in foolscap + tw_log.err(*args, **kwargs) if 'level' not in kwargs: kwargs['level'] = log.UNUSUAL return log.err(*args, **kwargs)