Cleanup: removal of mer, making things cleaner, etc
[quicknote] / src / gtk_toolbox.py
index a2a2e2a..784c871 100644 (file)
@@ -17,7 +17,7 @@ import gobject
 import gtk
 
 
 import gtk
 
 
-_moduleLogger = logging.getLogger("gtk_toolbox")
+_moduleLogger = logging.getLogger(__name__)
 
 
 def get_screen_orientation():
 
 
 def get_screen_orientation():
@@ -284,6 +284,22 @@ def threaded_stage(target, thread_factory = threading.Thread):
        return queue_sink(messages)
 
 
        return queue_sink(messages)
 
 
+def log_exception(logger):
+
+       def log_exception_decorator(func):
+
+               @functools.wraps(func)
+               def wrapper(*args, **kwds):
+                       try:
+                               return func(*args, **kwds)
+                       except Exception:
+                               logger.exception(func.__name__)
+
+               return wrapper
+
+       return log_exception_decorator
+
+
 class LoginWindow(object):
 
        def __init__(self, widgetTree):
 class LoginWindow(object):
 
        def __init__(self, widgetTree):