File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -359,7 +359,7 @@ class Formatter(object):
359359 responsible for converting a LogRecord to (usually) a string which can
360360 be interpreted by either a human or an external system. The base Formatter
361361 allows a formatting string to be specified. If none is supplied, the
362- default value of "%s(message)\\ n " is used.
362+ default value of "%s(message)" is used.
363363
364364 The Formatter can be initialized with a format string which makes use of
365365 knowledge of the LogRecord attributes - e.g. the default value mentioned
@@ -823,6 +823,8 @@ class StreamHandler(Handler):
823823 sys.stdout or sys.stderr may be used.
824824 """
825825
826+ terminator = '\n '
827+
826828 def __init__ (self , stream = None ):
827829 """
828830 Initialize the handler.
@@ -855,8 +857,8 @@ def emit(self, record):
855857 try :
856858 msg = self .format (record )
857859 stream = self .stream
858- fs = "%s \n "
859- stream .write (fs % msg )
860+ stream . write ( msg )
861+ stream .write (self . terminator )
860862 self .flush ()
861863 except (KeyboardInterrupt , SystemExit ):
862864 raise
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ Core and Builtins
3434Library
3535-------
3636
37+ - logging: Made StreamHandler terminator configurable.
38+
3739- logging: Allowed filters to be just callables.
3840
3941- logging: Added tests for _logRecordClass changes.
You can’t perform that action at this time.
0 commit comments