File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 55
66import datetime
77import logging
8+ import sys , traceback
89
910class StopCoroutineException ( Exception ):
1011 '''Exception used to stop a coroutine'''
@@ -51,7 +52,10 @@ def doWork(self):
5152 self .coroutines .remove ( coroutine )
5253 except Exception as e :
5354 self .lastExceptionCaught = e
54- logging .info ( "Scheduler - caught: %r, continuing." % (e ) )
55+ logging .info ( "Scheduler - caught: %r" % (e ) )
56+ exc_type , exc_value , exc_traceback = sys .exc_info ()
57+ trace = "" .join (traceback .format_tb (exc_traceback ))
58+ logging .debug ( "Traceback (latest call first):\n %s" % trace )
5559 self .coroutines .remove ( coroutine )
5660
5761 self .updateCoroutine .next ()
Original file line number Diff line number Diff line change 1111
1212from BrickPython .BrickPiWrapper import *
1313import unittest
14+ import logging
1415from mock import *
1516
1617class TestScheduler (unittest .TestCase ):
@@ -304,5 +305,6 @@ def outerCoroutine(self):
304305
305306
306307if __name__ == '__main__' :
308+ logging .basicConfig (format = '%(message)s' , level = logging .DEBUG ) # Logging is a simple print
307309 unittest .main ()
308310
You can’t perform that action at this time.
0 commit comments