24 January 2014

Analyzing log files are far too common to developers and customer supporters. However, the log in plain text isn't that naked-eye-friendly. Fortunately, with the help of the builtin compile.el, it is really simple to create log mode of your own to highlight your log entries and more. Basically, you only need to compose a correct regexp to match your log entries.

How Plain Text Logs Look Like

log-mode-off.png

How the same log file looks in log-mode

log-mode-on.png

Features supported

  • Highlights according to log level
  • One click to jump to corresponding spot
  • Easy "next/previous error"
  • "Smart" scroll while log file is growing
  • Adjust "root" path

    In many cases, log files are not put into arbitrary directories, rendering the relative paths in log messages invalid. In such cases, press "r" to specify the root of corresponding source code hierarchy ("relocate").

Ad-Hoc Keywords Highlighting

There is also a way to highlight keywords or regular expressions whatever mode/buffer you are in. But, IMHO, maybe it is most useful when reading logs.

log-mode-more.png

Source

The source code can be found at https://github.com/lgfang/elisp/blob/master/log-mode.el.

Read comment in it for how to install.



blog comments powered by Disqus