[GH-ISSUE #34] feature request: allow colouring lines based on tags #20

Closed
opened 2026-03-03 16:03:45 +03:00 by kerem · 7 comments
Owner

Originally created by @pmlopes on GitHub (Aug 27, 2014).
Original GitHub issue: https://github.com/mthenw/frontail/issues/34

For example I can tail some log file and look for a specific token "ERROR" which i would like to be shown as red, and DEBUG: which would be say green...

It would be nice to have some extra function before sending the line to grep for a tag/word and apply a colour to the whole line.

Originally created by @pmlopes on GitHub (Aug 27, 2014). Original GitHub issue: https://github.com/mthenw/frontail/issues/34 For example I can tail some log file and look for a specific token "ERROR" which i would like to be shown as red, and DEBUG: which would be say green... It would be nice to have some extra function before sending the line to grep for a tag/word and apply a colour to the whole line.
kerem 2026-03-03 16:03:45 +03:00
Author
Owner

@mthenw commented on GitHub (Sep 3, 2014):

Hi,

currently I'm on vacation. Will answer in next week.

<!-- gh-comment-id:54363653 --> @mthenw commented on GitHub (Sep 3, 2014): Hi, currently I'm on vacation. Will answer in next week.
Author
Owner

@keithics commented on GitHub (Sep 11, 2014):

+1

<!-- gh-comment-id:55282571 --> @keithics commented on GitHub (Sep 11, 2014): +1
Author
Owner

@orbitbot commented on GitHub (Oct 1, 2014):

I made a somewhat hacky implementation of the request while familiarizing myself with the codebase, the diff is here: github.com/orbitbot/frontail@4d658ed940

The change enables a new command line option --highlights <path to config.json>, that allows you to selectively apply CSS rules to a string or entire line matching a value in the JSON config. A sample file would have a structure like

{
    "words": {
        "pusselbiten": "color:yellow;"
    },
    "lines": {
        "wlan0": "background-color:green;"
    }
}

... where the words section will apply the CSS to the matched string itself, and the lines will apply the CSS rule to the whole line. N.B. that the string matching is case sensitive in my quick implementation.

Start frontail f.e. like this node-dev index.js /var/log/syslog -p 3001 -t dark --ui-no-indent --highlights highlights.json — if using the lines parameter there are some CSS rules about line indentation that cancel each other (?) but still makes the line background offset, unless the --ui-no-indent option is given.

<!-- gh-comment-id:57547741 --> @orbitbot commented on GitHub (Oct 1, 2014): I made a somewhat hacky implementation of the request while familiarizing myself with the codebase, the diff is here: https://github.com/orbitbot/frontail/commit/4d658ed9403936daed2c1328d4b72caf40d4035d The change enables a new command line option `--highlights <path to config.json>`, that allows you to selectively apply CSS rules to a string or entire line matching a value in the JSON config. A sample file would have a structure like ``` { "words": { "pusselbiten": "color:yellow;" }, "lines": { "wlan0": "background-color:green;" } } ``` ... where the `words` section will apply the CSS to the matched string itself, and the `lines` will apply the CSS rule to the whole line. **N.B.** that the string matching is case sensitive in my quick implementation. Start frontail f.e. like this `node-dev index.js /var/log/syslog -p 3001 -t dark --ui-no-indent --highlights highlights.json` &mdash; if using the `lines` parameter there are some CSS rules about line indentation that cancel each other (?) but still makes the line background offset, unless the `--ui-no-indent` option is given.
Author
Owner

@mthenw commented on GitHub (Oct 1, 2014):

@orbitbot that's super cool. I was thinking about similar thing. Could you create pull request for that? Or maybe I could use some parts of your diff to create it by myself?

<!-- gh-comment-id:57555363 --> @mthenw commented on GitHub (Oct 1, 2014): @orbitbot that's super cool. I was thinking about similar thing. Could you create pull request for that? Or maybe I could use some parts of your diff to create it by myself?
Author
Owner

@orbitbot commented on GitHub (Oct 2, 2014):

@mthenw I just made a pull request with the supplied diff, do as you please :) I was thinking about having a go at cleaning it up and handling some other cases, testing and documentation, but there's no guarantee that I'll have any time for that within a reasonable time.

Just out of curiosity, what is the reasoning behind the
margin-left: 84pt; text-indent: -84pt;
for the .inner-line CSS class? I doesn't seem to be meaningful with or without the command line option using the default CSS.

<!-- gh-comment-id:57586459 --> @orbitbot commented on GitHub (Oct 2, 2014): @mthenw I just made a pull request with the supplied diff, do as you please :) I was thinking about having a go at cleaning it up and handling some other cases, testing and documentation, but there's no guarantee that I'll have any time for that within a reasonable time. Just out of curiosity, what is the reasoning behind the `margin-left: 84pt; text-indent: -84pt;` for the `.inner-line` CSS class? I doesn't seem to be meaningful with or without the command line option using the default CSS.
Author
Owner

@mthenw commented on GitHub (Oct 2, 2014):

@orbitbot AFAIR it's used while marking line to get red background filling whole line.

<!-- gh-comment-id:57653058 --> @mthenw commented on GitHub (Oct 2, 2014): @orbitbot AFAIR it's used while marking line to get red background filling whole line.
Author
Owner

@mthenw commented on GitHub (Oct 6, 2014):

@pmlopes @keithics I've added new options --ui-highlight (https://github.com/mthenw/frontail#highlighting). Please provide your opinion about this.

Currently it's only in master, not published as new version to NPM.

<!-- gh-comment-id:58098070 --> @mthenw commented on GitHub (Oct 6, 2014): @pmlopes @keithics I've added new options --ui-highlight (https://github.com/mthenw/frontail#highlighting). Please provide your opinion about this. Currently it's only in master, not published as new version to NPM.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/frontail#20
No description provided.