author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Wed, 25 Feb 2015 01:06:19 +0200 | |
changeset 1225 | 613aa3cc60b8 |
parent 1137 | b260dc221119 |
child 1261 | ebbd2c480f1d |
permissions | -rw-r--r-- |
1076
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
|
1078
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
2 |
(defface log4-hi-error-face |
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
3 |
'((t :inherit error)) |
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
4 |
"Face for critical message.") |
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
5 |
|
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
6 |
(defface log4-hi-warn-face |
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
7 |
'((t :inherit warning)) |
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
8 |
"Face for urgent message.") |
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
9 |
|
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
10 |
(defface log4-hi-info-face |
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
11 |
'((t :inherit success)) |
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
12 |
"Face for informational message.") |
1076
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
13 |
|
1083
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
14 |
(defface log4-hi-func-face |
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
15 |
'((t :inherit font-lock-function-name-face)) |
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
16 |
"Face for functions in trace.") |
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
17 |
|
1136
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
18 |
(defface log4-hi-time-face |
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
19 |
'((t :inherit font-lock-builtin-face)) |
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
20 |
"Face for time.") |
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
21 |
|
1076
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
22 |
(defvar log4-hi-keywords |
1078
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
23 |
'(("FATAL\\|ERROR" . 'log4-hi-error-face) |
1134
d91fa7f7033a
Add keyword for highlighting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1083
diff
changeset
|
24 |
("WARN\\|SEVERE" . 'log4-hi-warn-face) |
1078
bd0c280abe8a
Define own faces to remove dependency on compile.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
25 |
("INFO\\|DEBUG\\|TRACE" . 'log4-hi-info-face) )) |
1076
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
26 |
|
1137
b260dc221119
Refactoring: fix according to naming convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1136
diff
changeset
|
27 |
(defvar log4-hi-func-keywords |
1083
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
28 |
'(("at [[:alnum:].]+\\.\\([[:alnum:]$]+\\.[[:alnum:]$<>]+\\)([[:alnum:]]+\\.java:[0-9]+)" 1 'log4-hi-func-face) )) |
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
29 |
|
1136
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
30 |
(defvar log4-hi-time-keywords |
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
31 |
'(("\\<[0-9]?[0-9]:[0-9][0-9]:[0-9][0-9]\\>" . 'log4-hi-time-face))) |
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
32 |
|
1137
b260dc221119
Refactoring: fix according to naming convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1136
diff
changeset
|
33 |
(defvar log4-hi-func t |
1083
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
34 |
"Mark to use hilighting of function names in stacktraces. Currently only Java supported.") |
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
35 |
|
1076
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
36 |
;;;###autoload |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
37 |
(define-minor-mode log4-hi-mode |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
38 |
"Highlight standard elements in log4* like log-files." |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
39 |
nil " log4-hi" nil |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
40 |
:global nil |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
41 |
(catch 'exit |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
42 |
(when log4-hi-mode |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
43 |
(font-lock-mode 1) |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
44 |
(font-lock-add-keywords nil log4-hi-keywords) |
1136
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
45 |
(font-lock-add-keywords nil log4-hi-time-keywords) |
1137
b260dc221119
Refactoring: fix according to naming convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1136
diff
changeset
|
46 |
(when log4-hi-func (font-lock-add-keywords nil log4-hi-func-keywords)) |
1076
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
47 |
(throw 'exit nil)) |
1083
d4b063fc0f5e
Add highlighting for Java stack traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1078
diff
changeset
|
48 |
(font-lock-remove-keywords nil log4-hi-keywords) |
1136
26996dddc80f
Add highlighting for time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1134
diff
changeset
|
49 |
(font-lock-remove-keywords nil log4-hi-time-keywords) |
1137
b260dc221119
Refactoring: fix according to naming convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1136
diff
changeset
|
50 |
(font-lock-remove-keywords nil log4-hi-func-keywords)) |
1076
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
51 |
(font-lock-fontify-buffer)) |
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
52 |
|
eed45b8a9e3a
Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
53 |
(provide 'log4-hi-mode) |