9 |
9 |
10 (defface log4-hi-info-face |
10 (defface log4-hi-info-face |
11 '((t :inherit success)) |
11 '((t :inherit success)) |
12 "Face for informational message.") |
12 "Face for informational message.") |
13 |
13 |
|
14 (defface log4-hi-func-face |
|
15 '((t :inherit font-lock-function-name-face)) |
|
16 "Face for functions in trace.") |
|
17 |
14 (defvar log4-hi-keywords |
18 (defvar log4-hi-keywords |
15 '(("FATAL\\|ERROR" . 'log4-hi-error-face) |
19 '(("FATAL\\|ERROR" . 'log4-hi-error-face) |
16 ("WARN" . 'log4-hi-warn-face) |
20 ("WARN" . 'log4-hi-warn-face) |
17 ("INFO\\|DEBUG\\|TRACE" . 'log4-hi-info-face) )) |
21 ("INFO\\|DEBUG\\|TRACE" . 'log4-hi-info-face) )) |
|
22 |
|
23 (defvar log4-func-hi-keywords |
|
24 '(("at [[:alnum:].]+\\.\\([[:alnum:]$]+\\.[[:alnum:]$<>]+\\)([[:alnum:]]+\\.java:[0-9]+)" 1 'log4-hi-func-face) )) |
|
25 |
|
26 (defvar log4-func-hi t |
|
27 "Mark to use hilighting of function names in stacktraces. Currently only Java supported.") |
18 |
28 |
19 ;;;###autoload |
29 ;;;###autoload |
20 (define-minor-mode log4-hi-mode |
30 (define-minor-mode log4-hi-mode |
21 "Highlight standard elements in log4* like log-files." |
31 "Highlight standard elements in log4* like log-files." |
22 nil " log4-hi" nil |
32 nil " log4-hi" nil |
23 :global nil |
33 :global nil |
24 (catch 'exit |
34 (catch 'exit |
25 (when log4-hi-mode |
35 (when log4-hi-mode |
26 (font-lock-mode 1) |
36 (font-lock-mode 1) |
27 (font-lock-add-keywords nil log4-hi-keywords) |
37 (font-lock-add-keywords nil log4-hi-keywords) |
|
38 (when log4-func-hi (font-lock-add-keywords nil log4-func-hi-keywords)) |
28 (throw 'exit nil)) |
39 (throw 'exit nil)) |
29 (font-lock-remove-keywords nil log4-hi-keywords)) |
40 (font-lock-remove-keywords nil log4-hi-keywords) |
|
41 (font-lock-remove-keywords nil log4-func-hi-keywords)) |
30 (font-lock-fontify-buffer)) |
42 (font-lock-fontify-buffer)) |
31 |
43 |
32 (provide 'log4-hi-mode) |
44 (provide 'log4-hi-mode) |