Mercurial > ~darius > hgwebdir.cgi > beermon.old
comparison beermon.py @ 5:dba51b33fd9e
Log backtrace on unexpected exception.
author | darius |
---|---|
date | Mon, 24 Sep 2007 13:34:47 +0000 |
parents | 618372f83862 |
children | a51f78d44552 |
comparison
equal
deleted
inserted
replaced
4:618372f83862 | 5:dba51b33fd9e |
---|---|
2 | 2 |
3 ############################################################################ | 3 ############################################################################ |
4 # Monitor & control fermenter temperature | 4 # Monitor & control fermenter temperature |
5 # v1.0 | 5 # v1.0 |
6 # | 6 # |
7 # $Id: beermon.py,v 1.3 2007/09/24 13:31:15 darius Exp $ | 7 # $Id: beermon.py,v 1.4 2007/09/24 13:34:47 darius Exp $ |
8 # | 8 # |
9 # Depends on: Python 2.3 (I think) | 9 # Depends on: Python 2.3 (I think) |
10 # | 10 # |
11 ############################################################################ | 11 ############################################################################ |
12 # | 12 # |
307 | 307 |
308 global log | 308 global log |
309 log = initLog() | 309 log = initLog() |
310 | 310 |
311 log.debug("=== Initing ===") | 311 log.debug("=== Initing ===") |
312 log.debug("$Id: beermon.py,v 1.3 2007/09/24 13:31:15 darius Exp $") | 312 log.debug("$Id: beermon.py,v 1.4 2007/09/24 13:34:47 darius Exp $") |
313 | 313 |
314 m = None | 314 m = None |
315 exitCode = 0 | 315 exitCode = 0 |
316 try: | 316 try: |
317 m = beermon.MonitorDev() | 317 m = beermon.MonitorDev() |
325 | 325 |
326 except KeyboardInterrupt: | 326 except KeyboardInterrupt: |
327 log.debug("Exiting due to keyboard interrupt") | 327 log.debug("Exiting due to keyboard interrupt") |
328 | 328 |
329 except Exception, e: | 329 except Exception, e: |
330 log.debug("Something went wrong, details below") | 330 log.debug("Something went wrong, details below:") |
331 log.debug(e) | 331 log.debug(e) |
332 #log.debug(reduce(lambda x, y: x + y, traceback.format_exception( | 332 log.debug(reduce(lambda x, y: x + y, traceback.format_exception( |
333 # sys.last_type, sys.last_value, sys.last_traceback))) | 333 sys.exc_type, sys.exc_value, sys.exc_traceback))) |
334 exitCode = 1 | 334 exitCode = 1 |
335 | 335 |
336 finally: | 336 finally: |
337 # Make sure we try and turn it off if something goes wrong | 337 # Make sure we try and turn it off if something goes wrong |
338 if (m != None): | 338 if (m != None): |