A R Karthick | 9313b76 | 2016-11-07 13:14:35 -0800 | [diff] [blame^] | 1 | from OnosLog import OnosLog |
| 2 | from scapy.all import log |
| 3 | import unittest |
| 4 | |
| 5 | class CordLogger(unittest.TestCase): |
| 6 | |
| 7 | def setUp(self): |
| 8 | '''Read the log buffer''' |
| 9 | try: |
| 10 | onosLog = OnosLog() |
| 11 | st, output = onosLog.get_log() |
| 12 | onosLog.close() |
| 13 | except: pass |
| 14 | |
| 15 | def tearDown(self): |
| 16 | '''Dump the log buffer for ERRORS/warnings''' |
| 17 | try: |
| 18 | onosLog = OnosLog() |
| 19 | st, output = onosLog.get_log( ('ERROR','WARN') ) |
| 20 | onosLog.close() |
| 21 | if st and output: |
| 22 | log.info('\nTest %s has errors and warnings\n' %self._testMethodName) |
| 23 | log.info('%s' %output) |
| 24 | else: |
| 25 | log.info('\nTest %s has no errors and warnings in the logs' %self._testMethodName) |
| 26 | except: pass |