title: vim: custom highlighting for log files
body: <p>I have log files that take the following form:</p>
  
  <p><code>YYYY-MM-DD HH:MM:SS.sss SEVERITY  [thread.name] class.name:line -</code></p>
  
  <p>SEVERITY is one of DEBUG, INFO, WARN, or ERROR.</p>
  
  <p>I have a syntax file set up that uniquely highlights the timestamp and each of the different severities.  Now, however, I want to highlight the thread name, and the class name and line number. the issue is that there may be square brackets within the log messages, so simply starting at <code>+\[+</code> and ending on <code>+\]+</code> wouldn't work.</p>
  
  <p>I'd love to put down what I've tried but honestly I just have not idea how to do it.  Here's the file I have so far:</p>
  
  <pre><code>:syn region logTime start=+^\d\{4}-\d\{2}-\d\{2} \d\{2}:\d\{2}:\d\{2}+ end=+ +me=e-1
  :syn region logError start=+ERROR+ end=+ +me=e-1
  :syn region logWarn start=+WARN+ end=+ +me=e-1
  :syn region logInfo start=+INFO+ end=+ +me=e-1
  :syn region logDebug start=+DEBUG+ end=+ +me=e-1
  
  hi def logError ctermfg=white ctermbg=red
  hi def logWarn ctermfg=yellow
  hi def logInfo ctermfg=green
  hi def logDebug ctermfg=blue
  hi def logTime ctermfg=white ctermbg=blue
  </code></pre>