Syntax highlighting for THOR APT Scanner text log files.
Coming soon — once this package is registered with MELPA.
(use-package thorlog-mode
:straight (:host github :repo "Nextron-Labs/thor-syntax-highlighting"
:files ("emacs/thorlog-mode.el")))To update after changes:
(straight-pull-package 'thorlog-mode)
(straight-use-package 'thorlog-mode)(use-package thorlog-mode
:quelpa (thorlog-mode :fetcher github
:repo "Nextron-Labs/thor-syntax-highlighting"
:files ("emacs/thorlog-mode.el")))To update after changes:
(quelpa-upgrade 'thorlog-mode)Add to packages.el:
(package! thorlog-mode
:recipe (:host github :repo "Nextron-Labs/thor-syntax-highlighting"
:files ("emacs/thorlog-mode.el")))To update after changes:
(doom refresh)-
Copy
thorlog-mode.elto your Emacs load path (e.g.~/.emacs.d/lisp/):mkdir -p ~/.emacs.d/lisp cp emacs/thorlog-mode.el ~/.emacs.d/lisp/
-
Add to your init file (
~/.emacs.d/init.elor~/.emacs):(add-to-list 'load-path "~/.emacs.d/lisp") (require 'thorlog-mode)
The mode auto-detects files with the extensions .thor.log and .thor.txt, and files whose first line matches the THOR log format.
For other files, activate the mode manually:
M-x thorlog-mode
Or add a file-local variable at the end of the log file:
# Local Variables:
# mode: thorlog
# End:
Or add a pattern to your init file:
(add-to-list 'auto-mode-alist '("_thor_.*\\.\\(txt\\|log\\)\\'" . thorlog-mode))All faces belong to the thorlog customization group. Customize them with:
M-x customize-group RET thorlog RET
Or set them in your init file:
(set-face-attribute 'thorlog-level-alert nil :foreground "red" :weight 'bold)
(set-face-attribute 'thorlog-level-warning nil :foreground "orange")
(set-face-attribute 'thorlog-field-key nil :foreground "sea green")
(set-face-attribute 'thorlog-hash nil :foreground "medium purple")| Element | Face | Default Inherits |
|---|---|---|
| Timestamps | thorlog-timestamp |
font-lock-constant-face |
| Hostnames | thorlog-hostname |
font-lock-variable-name-face |
Source (THOR:) |
thorlog-source |
font-lock-keyword-face |
| Alert / Error | thorlog-level-alert / thorlog-level-error |
error |
| Warning | thorlog-level-warning |
warning |
| Notice | thorlog-level-notice |
font-lock-function-name-face |
| Info | thorlog-level-info |
font-lock-comment-face |
| Field keys | thorlog-field-key |
font-lock-type-face |
| Hashes | thorlog-hash |
font-lock-string-face |
| IP addresses | thorlog-ip-address |
font-lock-constant-face |
| Scan IDs | thorlog-scan-id |
font-lock-constant-face |
| Numbers | thorlog-number |
font-lock-constant-face |
All faces adapt to your color theme. They use standard font-lock faces as defaults for maximum compatibility.