# HG changeset patch # User Oleksandr Gavenko # Date 1382202055 -10800 # Node ID d4b063fc0f5e605955d6249cbacca84b35172d45 # Parent 964519e5a5ac550cdd6c7c3f4527630580ae2684 Add highlighting for Java stack traces. diff -r 964519e5a5ac -r d4b063fc0f5e log4-hi-mode.el --- a/log4-hi-mode.el Tue Oct 15 16:13:22 2013 +0300 +++ b/log4-hi-mode.el Sat Oct 19 20:00:55 2013 +0300 @@ -11,11 +11,21 @@ '((t :inherit success)) "Face for informational message.") +(defface log4-hi-func-face + '((t :inherit font-lock-function-name-face)) + "Face for functions in trace.") + (defvar log4-hi-keywords '(("FATAL\\|ERROR" . 'log4-hi-error-face) ("WARN" . 'log4-hi-warn-face) ("INFO\\|DEBUG\\|TRACE" . 'log4-hi-info-face) )) +(defvar log4-func-hi-keywords + '(("at [[:alnum:].]+\\.\\([[:alnum:]$]+\\.[[:alnum:]$<>]+\\)([[:alnum:]]+\\.java:[0-9]+)" 1 'log4-hi-func-face) )) + +(defvar log4-func-hi t + "Mark to use hilighting of function names in stacktraces. Currently only Java supported.") + ;;;###autoload (define-minor-mode log4-hi-mode "Highlight standard elements in log4* like log-files." @@ -25,8 +35,10 @@ (when log4-hi-mode (font-lock-mode 1) (font-lock-add-keywords nil log4-hi-keywords) + (when log4-func-hi (font-lock-add-keywords nil log4-func-hi-keywords)) (throw 'exit nil)) - (font-lock-remove-keywords nil log4-hi-keywords)) + (font-lock-remove-keywords nil log4-hi-keywords) + (font-lock-remove-keywords nil log4-func-hi-keywords)) (font-lock-fontify-buffer)) (provide 'log4-hi-mode)