Skip to content

Commit

Permalink
all done
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Pi committed Nov 10, 2013
1 parent 713f0b6 commit 1fb6009
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,21 @@ lagerLogSyntax
==============

Vim syntax for lager(https://github.com/basho/lager) log files

FEATURES
--------

* highlights log level in different colors
* display timestamps gray
* highlights module and function names
* highlights PIDs and nodes

INSTALL
-------

using [pathogen](https://github.com/tpope/vim-pathogen):

cd ~/.vim/bundle/
git clone https://github.com/Mr-Pi/lagerLogSyntax.git


10 changes: 10 additions & 0 deletions ftdetect/lagerLog.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
" Language: Erlang lager log files
" Maintainer: Mr. Pi <[email protected]>
" Last Change: 2013-11-10
" Version: 1.0.0-r1

if did_filetype()
finish
endif

au BufNewFile,BufRead *.log if getline(1) =~ '^\d\{4}-\d\{2}-\d\{2} [0-9:]\{8}\.\d\{3} \(\[debug\]\|\[info\]\|\[notice\]\|\[warning\]\|\[error\]\|\[critical\]\|\[alert\]\|\[emergency\]\).*$' | setf lagerLog | endif
40 changes: 40 additions & 0 deletions syntax/lagerLog.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
" Vim syntax file
" Language: Erlang lager log files
" Maintainer: Mr. Pi <[email protected]>
" Last Change: 2013-11-10
" Version: 1.0.0-r1

if exists("b:current_syntax")
finish
else
let b:current_syntax = "lagerLog"
endif

syn match erlangNode '\'[^']*@[^']*\''
syn match erlangModuleFunction '[^0-9 :@]\+:[^0-9 :/\()]\+/\d\+'
syn match erlangModuleFunction '[^0-9 :@]\+:[^0-9 :/\()]\+([^()]*)'
syn match lagerTimeStamp '^\d\{4}-\d\{2}-\d\{2} [0-9:]\{8}\.\d\{3} ' nextgroup=lagerSeverity
syn match lagerSeverityDebug '\(\[debug\]\)'
syn match lagerSeverityNormal '\(\[info\]\|\[notice\]\)'
syn match lagerSeverityWarning '\(\[warning\]\)'
syn match lagerSeverityError '\(\[error\]\)'
syn match lagerSeverityCritical '\(\[critical\]\|\[alert\]\|\[emergency\]\)'
syn match erlangPID '<\d\+\.\d\+\.\d\+>'
syn match lagerAtModule '@[^:]*' nextgroup=lagerFunction
syn match lagerFunction ':[^0-9 :]\+' nextgroup=lagerLineNumber
syn match lagerLineNumber ':\d\+'

hi lagerSeverityDebug term=bold cterm=bold ctermfg=gray
hi lagerSeverityNormal term=bold,underline cterm=bold,underline ctermfg=white
hi lagerSeverityWarning term=bold,underline cterm=bold,underline ctermfg=yellow
hi lagerSeverityError term=bold,underline cterm=bold,underline ctermfg=gray ctermbg=red
hi lagerSeverityCritical term=bold,underline cterm=bold,underline ctermfg=red ctermbg=gray

hi def link erlangModuleFunction Function
hi def link erlangNode Constant
hi def link lagerTimeStamp Comment
hi def link lagerSeverity Error
hi def link erlangPID Label
hi def link lagerAtModule Identifier
hi def link lagerFunction Function
hi def link lagerLineNumber Number

0 comments on commit 1fb6009

Please sign in to comment.