fix fancy txnid logging
This commit is contained in:
parent
24590669d8
commit
8ad87f634c
2
bin/st
2
bin/st
@ -44,6 +44,8 @@ except:
|
|||||||
try:
|
try:
|
||||||
from swift.common.bufferedhttp \
|
from swift.common.bufferedhttp \
|
||||||
import BufferedHTTPConnection as HTTPConnection
|
import BufferedHTTPConnection as HTTPConnection
|
||||||
|
import __builtin__ # bufferedhttp uses automagic gettext
|
||||||
|
setattr(__builtin__, '_', lambda x: x)
|
||||||
except:
|
except:
|
||||||
from httplib import HTTPConnection
|
from httplib import HTTPConnection
|
||||||
|
|
||||||
|
@ -341,7 +341,8 @@ class NamedFormatter(logging.Formatter):
|
|||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
msg = logging.Formatter.format(self, record)
|
msg = logging.Formatter.format(self, record)
|
||||||
if record.levelno != logging.INFO and self.logger.txn_id:
|
if self.logger.txn_id and (record.levelno != logging.INFO or
|
||||||
|
self.logger.txn_id not in msg):
|
||||||
return '%s %s (txn: %s)' % (self.server, msg, self.logger.txn_id)
|
return '%s %s (txn: %s)' % (self.server, msg, self.logger.txn_id)
|
||||||
else:
|
else:
|
||||||
return '%s %s' % (self.server, msg)
|
return '%s %s' % (self.server, msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user