This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients chris.jerdonek, r.david.murray, vinay.sajip
Date 2013-01-08.01:58:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357610284.86.0.286455325565.issue16889@psf.upfronthosting.co.za>
In-reply-to
Content
In certain situations (e.g. when logging while using unittest), log messages can start in the middle of a line, for example:

........................log: [INFO] foo
..................................................

It was trickier than I thought it needed to be to get log messages to start at the beginning of a line, which seems like a reasonable expectation.

It would be good if the logging module (or perhaps unittest for when running tests?) provided assistance here, either through documentation or an enhancement.

The way I did this was wrap sys.stderr in a class that remembers the last written character, pass this to the test runner, and then subclass logging.StreamHandler to have emit() check whether a newline was the last character.  But perhaps there is a much simpler way.
History
Date User Action Args
2013-01-08 01:58:04chris.jerdoneksetrecipients: + chris.jerdonek, vinay.sajip, r.david.murray
2013-01-08 01:58:04chris.jerdoneksetmessageid: <1357610284.86.0.286455325565.issue16889@psf.upfronthosting.co.za>
2013-01-08 01:58:04chris.jerdoneklinkissue16889 messages
2013-01-08 01:58:03chris.jerdonekcreate