diff options
Diffstat (limited to 'elogt.el')
-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." |