Open deseven opened 5 years ago
+1 to this. I wouldn't mind doing this myself as I have a fully functional ANSI parser in both C/Java, but I'd have to port to go and web frontend development isn't my forte. If somebody could point me in the right direction, I'd be happy to contribute.
I just implemented this in the Python version of tailon. I’m using a rewritten version of grc (grcat) to insert ANSI codes, and ansi2html to convert to inline html.
The only slight issue is in the logfile.js file, you have to remove the escapeHtml filter, otherwise the inline html prints as plain text instead of being rendered. This also means that any inline html you try to view will also be rendered. I haven’t had too much problem with this, as most log files don’t have inline html in them.
There are some escape sequences for terminals, usually used for color output. Many loggers love to use them.
As an example:
[31msome text[39m
As a bare minimum, if you don't want to make color support, it would be nice to at least know about it and strip them from text completely.