Anonymous avatar Anonymous committed bea442d

decorators: added Logger.only_short

Comments (0)

Files changed (1)


 class Logger(object):
     message = None
+    only_short = False
-    def __call__(self, message):
+    def __call__(self, message, short=None):
+        if short is None or not self.only_short:
+            self._show(message)
+        if short is not None:
+            self._show(short)
+    def _show(self, message):
         if message is None:
             print message
             func(*args, **kwds)
         except Exception, e:
             trace = str(traceback.format_exc())
-            logger('%s\nIgnored an exception in ropemacs hook: %s' %
-                   (trace, _exception_message(e)))
+            short = 'Ignored an exception in ropemode hook: %s' % \
+                    _exception_message(e)
+            logger(trace, short)
     newfunc.lisp = None
     newfunc.__name__ = func.__name__
     newfunc.__doc__ = func.__doc__
             func(*args, **kwds)
         except exceptions.RopeError, e:
-            logger(str(traceback.format_exc()))
+            short = None
             if isinstance(e, input_exceptions):
-                logger(_exception_message(e))
+                short = _exception_message(e)
+            logger(str(traceback.format_exc()), short)
     newfunc.__name__ = func.__name__
     newfunc.__doc__ = func.__doc__
     return newfunc
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.