Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logger to support HTML colors #23

Open
empijei opened this issue Oct 2, 2017 · 0 comments
Open

Improve logger to support HTML colors #23

empijei opened this issue Oct 2, 2017 · 0 comments

Comments

@empijei
Copy link
Owner

empijei commented Oct 2, 2017

Logger now outputs ANSI escape sequences to stdout.

It should be possible to set an io.Writer in the cli/lg package where the logger will write HTML formatted output. (it should do nothing if such writer is not set)

When now a line of output is foo \x1b[31mbar\x1b[0m
It should become foo <span style="color:#A00">bar</span>,

Some example here:
https://github.com/rburns/ansi-to-html/blob/master/src/ansi_to_html.js#L203

It would be better to wrap calls to log to directly output HTML-formatted outputs instead of converting it.

To achieve this a list as this one could be used, but for HTML instead of ANSI.

Implementing an "HTMLString" method like ShortString should work.

Please cover your code with tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant