Tudyx / tree-sitter-log

General tree sitter grammar for log files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tree-sitter log

A tree sitter grammar that's trying to be general enough to work through most log files. Mainly inspired by the VSCode extension and this repo. For now it's integrated into Helix Editor, but can be used everywhere you use tree-sitter.

If something is not highlighted as you want, feel free to submit a PR or open an issue.

The most important files are grammar.js and test/corpus/testsuite.log, almost all the rest is generated by the tree-sitter command line tool.

How to

You need to install the requirements for tree-sitter, you can follow the official doc.

Build

tree-sitter generate

Test

tree-sitter generate && tree-sitter test

Highlight a file

You will need to configure a theme for this, see this link. An example that defines the theme for the queries can be found in the file config.json.

tree-sitter generate && tree-sitter highlight <FILE_PATH>.log

What can be improved

  • add url parsing
  • known_failures.log tests

About

General tree sitter grammar for log files

License:MIT License


Languages

Language:C 97.7%Language:JavaScript 1.2%Language:Rust 0.7%Language:C++ 0.2%Language:Python 0.1%Language:Scheme 0.0%