Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pavelrevak/highlight
Text or log file highlighter and analyzer
https://github.com/pavelrevak/highlight
Last synced: 1 day ago
JSON representation
Text or log file highlighter and analyzer
- Host: GitHub
- URL: https://github.com/pavelrevak/highlight
- Owner: pavelrevak
- License: mit
- Created: 2023-10-16T21:28:17.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-31T07:55:12.000Z (about 1 year ago)
- Last Synced: 2023-10-31T08:40:21.721Z (about 1 year ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Highlight
Simple tool to highlight and graph text files, especially log files like text log analyzer.
## Supports
- filter lines to include or exclude by text match
- colorize words or colorize whole line with text match
- create simple binary graph, based on START and END text match### Filter lines
Print only lines with text ERROR and WARNING but exclude with text "open file" and "close file" (like `grep` or `grep -v` to exclude)
```
$ highlight -i ERROR -i WARNING -e "open file" -e "close file"
```### Highlight lines
Colorize lines to `red` containing text `ERROR`, to `yellow` with WARNING
```
$ highlight -l r ERROR -l y WARNING
```### Highlight word
Colorize word `socket.read` to `blue` socket.write to `pink`.
```
$ highlight -w b socket.read -l p socket.write
```### Graph
Create vertical graph line with `cyan` character `C` where start is with text `connection.lock` and stops with `connection.unlock` and `yellow` `G` starting `gate open` ending `gate close`
```
$ highlight -g c C connection.lock connection.unlock -g y G "gate open" "gate close"
```### Preview
## supported colors
- k black
- r red
- y yellow
- g green
- c cyan
- b blue
- m magenta
- p pink
- w white
- gr gray
- lr lred
- ly lyellow
- lg lgreen
- lc lcyan
- lb lblue
- lm lmagenta
- lp lpink
- lw lwhite### COLOR format
- foreground lr lred
- :background :g :green
- foreground:background w:b white:blue## Help
```
$ highlight --help
usage: highlight.py [-h] [-i MATCH] [-e MATCH] [-l COLOR MATCH] [-w COLOR MATCH] [-g COLOR CHAR MATCH_START MATCH_END] [files ...]positional arguments:
files file names, or pipeoptions:
-h, --help show this help message and exit
-i MATCH, --include MATCH
include lines with match
-e MATCH, --exclude MATCH
exclude lines with match
-l COLOR MATCH, --line COLOR MATCH
colorize line with match
-w COLOR MATCH, --word COLOR MATCH
colorize match
-g COLOR CHAR MATCH_START MATCH_END, --graph COLOR CHAR MATCH_START MATCH_END
draw vertical binary graph on left side
```## Installation
```
pip install git+https://github.com/pavelrevak/highlight.git
```### Uninstall
```
pip uninstall log-highlighter
```