New submission from Chris Jerdonek:

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.

----------
components: Library (Lib)
messages: 179304
nosy: chris.jerdonek, r.david.murray, vinay.sajip
priority: normal
severity: normal
status: open
title: facilitate log output starting at beginning of line
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16889>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to