Coder Social home page Coder Social logo

vim-logreview's Introduction

vim-logreview

Plugin to help review logs files within VIM. This was created with Java log files in mind, however the functionality could work for other log files as well or you can edit this plugin or send a pull requeest to suite your needs.

Instalation

You can use Pathogen

git clone https://github.com/andreshazard/vim-logreview.git
~/.vim/bundle/vim-logreview.vim

For Vundle add to your vimrc

Plugin 'andreshazard/vim-logreview'

Usage

The plugin will detect your .log files and set the filetype as logreview. If you need work with log files that do not have the .log extension. You can run :

set filetype=logreview

The logreview file types will have highlighting on specific keywords like : INFO, DEBUG, WARN, ERROR, etc. You can see this on the syntax folder.

snapshot

Functions

The plugin will load the following commands when working with a logreview file types.

:RemoveDEBUGLogs Will remove all lines containing a "DEBUG" log
:RemoveINFOLogs Will remove all lines containing a "INFO" log
:RemoveGREENLogs Will remove all lines containing a "INFO" or "DEBUG" log
:RemoveWARNLogs Will remove all lines containing a "WARN" log
:RemoveAllButERRORLogs Will remove all lines that do not contain an "ERROR" log
:RemoveAllButCRITICALLogs Will remove all lines that do not contain a "CRITICAL" log
:RemoveAtExpLogs Will remove all lines that contain an " at com.project.package classname test" type log

gif

:RemoveButRangeDayTime day start end

This will remove all lines except the ones on the range you provided. For example you can call :
RemoveButRange 09 10:52 10:54 to get only the logs between 10:52 and 10:54 on day 09. This works using the search command so a line cotaining those lines needs to exist on the file. Example of a log line where this would work :

2016-04-07 10:52:04,459 [AsyncAppender-Dispatcher-Thread-18] DEBUG com.whatever.module.mail.service

:RemoveButRangeFullDateTime date start end

This will remove all lines except the ones on the range you provided. For example you can call :
RemoveButRange 08.04.2016 10:52 10:54

to get only the logs between 10:52 and 10:54 of the date 08.04.2016. This works using the search command so a line cotaining those lines needs to exist on the file. Example of a log line where this would work :

08.04.2016 10:52:04,459 [AsyncAppender-Dispatcher-Thread-18] DEBUG com.trainingrocket.module.mail.service

:RemoveAllButClass

This will remove all lines except the ones containing the string you passed to the function. For example you can call : RemoveAllBut com.example.my_bad_class to get only logs relatd to this class.

gif

:FoldStackBelow

This will create a mark fold of the stack below the cursor. It assumes that the stack lines start with at lease one space.

gif

##Mappings

You can map the commands that you use the most on your vimrc. For example :

:nnoremap <leader>bf :call FoldStackBelow()<CR>

vim-logreview's People

Contributors

andreshazard avatar olshevskiy87 avatar veelenga avatar iaalm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.