Merge lp:~jml/launchpad/fix-logger into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Jonathan Lange
Approved revision: no longer in the source branch.
Merged at revision: 11626
Proposed branch: lp:~jml/launchpad/fix-logger
Merge into: lp:launchpad
Diff against target: 15 lines (+1/-4)
1 file modified
lib/canonical/launchpad/scripts/logger.py (+1/-4)
To merge this branch: bzr merge lp:~jml/launchpad/fix-logger
Reviewer Review Type Date Requested Status
Jonathan Lange (community) Approve
Review via email: mp+36532@code.launchpad.net

Commit message

Simplify FakeLogger, fixing bug caused by spurious string interpolation.

Description of the change

This kills some overly complex custom logger code that turned out to also be buggy.

Basically, if you called FakeLogger methods passing exc_info and there was a '%s' somewhere in your stack, FakeLogger would try to do string interpolation on the stack trace and fail. Now it just uses the built-in Python method to print exceptions to print the exception.

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

Julian did the work. I'm just pushing up & reviewing.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/scripts/logger.py'
2--- lib/canonical/launchpad/scripts/logger.py 2010-08-20 20:31:18 +0000
3+++ lib/canonical/launchpad/scripts/logger.py 2010-09-24 08:39:54 +0000
4@@ -87,10 +87,7 @@
5 print >> output_file, prefix, msg % stuff
6
7 if 'exc_info' in kw:
8- exception = traceback.format_exception(*sys.exc_info())
9- for thing in exception:
10- for line in thing.splitlines():
11- self.log(line)
12+ traceback.print_exc(file=output_file)
13
14 def log(self, *stuff, **kw):
15 self.message('log>', *stuff, **kw)