diff options
author | Maciej Barć <xgqt@gentoo.org> | 2023-02-03 19:49:57 +0100 |
---|---|---|
committer | Maciej Barć <xgqt@gentoo.org> | 2023-02-03 19:49:57 +0100 |
commit | 00dd215baacf50aefc886dfb7491fea07852d493 (patch) | |
tree | a5262f6eb056fa1bc1bc2702b6cb789b8526d5e2 | |
parent | elogt.el: change post-refresh message (diff) | |
download | emacs-elogt-00dd215baacf50aefc886dfb7491fea07852d493.tar.gz emacs-elogt-00dd215baacf50aefc886dfb7491fea07852d493.tar.bz2 emacs-elogt-00dd215baacf50aefc886dfb7491fea07852d493.zip |
elogt.el: colorize levels
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r-- | elogt.el | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -50,6 +50,12 @@ (" \e[32m*\e[0m" . info) (" \e[33;01m*\e[0m" . warn))) +(defconst elogt--priority-level-indicators + `((error . ,(propertize "Error" 'font-lock-face '(:foreground "red"))) + (info . ,(propertize "Info" 'font-lock-face '(:foreground "green"))) + (warn . ,(propertize "Warn" 'font-lock-face '(:foreground "orange"))) + (none . ,(propertize "None" 'font-lock-face '(:foreground "purple"))))) + ;; Customization @@ -91,17 +97,21 @@ If set to nil entries will have a phony Info level." (kill-buffer buffer) found-stars)) +(defun elogt--priority-level-property (key) + "Rerun a value referenced by KEY of ‘elogt--priority-level-indicators’." + (cdr (assoc key elogt--priority-level-indicators))) + (defun elogt--logfile-priority-level (file-name) "Return a FILE-NAME priority level. A logfile priority level is one of: None, Info, Warn, Error." (let ((found-stars (elogt--logfile-find-stars file-name))) (cond - ((not elogt-check-priority) "Info") - ((null found-stars) "None") - ((member 'error found-stars) "Error") - ((member 'warn found-stars) "Warn") - (t "Info")))) + ((not elogt-check-priority) (elogt--priority-level-property 'info)) + ((null found-stars) (elogt--priority-level-property 'none)) + ((member 'error found-stars) (elogt--priority-level-property 'error)) + ((member 'warn found-stars) (elogt--priority-level-property 'warn)) + (t (elogt--priority-level-property 'info))))) (defun elogt--logfile-properties (file-name) "Extract the properties form given FILE-NAME." |