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() |
A R Karthick | 9313b76 | 2016-11-07 13:14:35 -0800 | [diff] [blame] | 12 | except: pass |
| 13 | |
| 14 | def tearDown(self): |
| 15 | '''Dump the log buffer for ERRORS/warnings''' |
| 16 | try: |
| 17 | onosLog = OnosLog() |
| 18 | st, output = onosLog.get_log( ('ERROR','WARN') ) |
A R Karthick | 9313b76 | 2016-11-07 13:14:35 -0800 | [diff] [blame] | 19 | if st and output: |
| 20 | log.info('\nTest %s has errors and warnings\n' %self._testMethodName) |
| 21 | log.info('%s' %output) |
| 22 | else: |
| 23 | log.info('\nTest %s has no errors and warnings in the logs' %self._testMethodName) |
| 24 | except: pass |