49 lines
1.7 KiB
Diff
49 lines
1.7 KiB
Diff
---
|
|
nose/plugins/logcapture.py | 13 +++++++++++++
|
|
1 file changed, 13 insertions(+)
|
|
|
|
--- a/nose/plugins/logcapture.py
|
|
+++ b/nose/plugins/logcapture.py
|
|
@@ -110,6 +110,8 @@ class LogCapture(Plugin):
|
|
logdatefmt = None
|
|
clear = False
|
|
filters = ['-nose']
|
|
+ realtime = False
|
|
+
|
|
|
|
def options(self, parser, env):
|
|
"""Register commandline options.
|
|
@@ -156,6 +158,10 @@ class LogCapture(Plugin):
|
|
"--logging-level", action="store",
|
|
default='NOTSET', dest="logcapture_level",
|
|
help="Set the log level to capture")
|
|
+ parser.add_option(
|
|
+ "--logging-realtime", action="store_true",
|
|
+ default=False, dest="logcapture_realtime",
|
|
+ help="Set to display log in realtime")
|
|
|
|
def configure(self, options, conf):
|
|
"""Configure plugin.
|
|
@@ -171,6 +177,7 @@ class LogCapture(Plugin):
|
|
self.loglevel = options.logcapture_level
|
|
if options.logcapture_filters:
|
|
self.filters = options.logcapture_filters.split(',')
|
|
+ self.logrealtime = options.logcapture_realtime
|
|
|
|
def setupLoghandler(self):
|
|
# setup our handler with root logger
|
|
@@ -193,6 +200,12 @@ class LogCapture(Plugin):
|
|
if isinstance(handler, MyMemoryHandler):
|
|
root_logger.handlers.remove(handler)
|
|
root_logger.addHandler(self.handler)
|
|
+
|
|
+ # added to see realtime logging - 31 Oct 2014
|
|
+ # add stderr output
|
|
+ if self.logrealtime:
|
|
+ root_logger.addHandler(logging.StreamHandler())
|
|
+
|
|
# to make sure everything gets captured
|
|
loglevel = getattr(self, "loglevel", "NOTSET")
|
|
root_logger.setLevel(getattr(logging, loglevel))
|
|
|