log4-hi-mode.el
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 19 Oct 2013 19:05:32 +0300
changeset 1085 e5be6d749d06
parent 1078 bd0c280abe8a
child 1083 d4b063fc0f5e
permissions -rw-r--r--
Check if 'package-initialize' present.


(defface log4-hi-error-face
  '((t :inherit error))
  "Face for critical message.")

(defface log4-hi-warn-face
  '((t :inherit warning))
  "Face for urgent message.")

(defface log4-hi-info-face
  '((t :inherit success))
  "Face for informational message.")

(defvar log4-hi-keywords
  '(("FATAL\\|ERROR" . 'log4-hi-error-face)
    ("WARN" . 'log4-hi-warn-face)
    ("INFO\\|DEBUG\\|TRACE" . 'log4-hi-info-face) ))

;;;###autoload
(define-minor-mode log4-hi-mode
  "Highlight standard elements in log4* like log-files."
  nil " log4-hi" nil
  :global nil
  (catch 'exit
    (when log4-hi-mode
      (font-lock-mode 1)
      (font-lock-add-keywords nil log4-hi-keywords)
      (throw 'exit nil))
    (font-lock-remove-keywords nil log4-hi-keywords))
  (font-lock-fontify-buffer))

(provide 'log4-hi-mode)