diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-12-01 16:08:12 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-12-01 16:08:12 +0000 |
commit | f3fd118a71ee2e82a2f5f6d1415700c15428538f (patch) | |
tree | e12b144fe9413e1e4ce185e91ead58e0d0cfff4d /lib/thandy/ClientCLI.py | |
parent | 5cf4885e09fddfd0649bef62447517f802de8895 (diff) |
Make controller logging work better on python 2.4 (where the "extra" feature of logger.log does not exist.)
git-svn-id: file:///home/or/svnrepo/updater/trunk@17431 55e972cd-5a19-0410-ae62-a4d7a52db4cd
Diffstat (limited to 'lib/thandy/ClientCLI.py')
-rw-r--r-- | lib/thandy/ClientCLI.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/thandy/ClientCLI.py b/lib/thandy/ClientCLI.py index 839889b..14a149a 100644 --- a/lib/thandy/ClientCLI.py +++ b/lib/thandy/ClientCLI.py @@ -22,22 +22,14 @@ import thandy.encodeToXML json = thandy.util.importJSON() class ControlLogFormatter: - def _formatStr(self, s): - s = '"%s"' % re.sub(r'(["\\])', r'\\\1', s) - s = s.replace("\n", "\\n") - return s - def format(self, record): name = record.name if name == 'thandy-ctrl': - parts = [ record.msg ] - parts.extend( - "%s=%s"%(k, self._formatStr(v)) - for k,v in sorted(getattr(record, 'cmd_args', {}).iteritems())) - return " ".join(parts) + return record.getMessage() else: m = record.getMessage() - return "%s msg=%s"%(record.levelname, self._formatStr(m)) + return "%s msg=%s"%(record.levelname, + thandy.util.formatLogString(m)) def formatException(self, exc_info): return repr(traceback.print_exception()) |