added an application wide exception handler

This commit is contained in:
fpdb-mme 2009-11-03 16:09:58 +01:00
parent 944d48d7ef
commit 92f98e9f51

View File

@ -59,6 +59,14 @@ DATABASE_TYPES = (
logging.config.fileConfig(os.path.join(DIR_SELF,"logging.conf")) logging.config.fileConfig(os.path.join(DIR_SELF,"logging.conf"))
log = logging.getLogger("config") log = logging.getLogger("config")
# setup application wide exception handler
def excepthook(Type, value, tb):
p = traceback.format_exception(type, value, tb)
log.critical(p)
raise Type(value)
sys.excepthook = excepthook
######################################################################## ########################################################################
def string_to_bool(string, default=True): def string_to_bool(string, default=True):
"""converts a string representation of a boolean value to boolean True or False """converts a string representation of a boolean value to boolean True or False