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

Feature request - Colored console text #16

Open
rcurrier666 opened this issue Jan 24, 2019 · 2 comments
Open

Feature request - Colored console text #16

rcurrier666 opened this issue Jan 24, 2019 · 2 comments

Comments

@rcurrier666
Copy link

With several of my apps I leave the log lines visible in a console window continuously. I'd like to be able to differentiate warnings, errors, and criticals from the other log lines at a glance by color coding the output based on the log level. This may not be of general interest, but someone else might find it useful.

I'm thinking of adding a new function, SetColors(), that takes an 8 item array where each item is a color to use for that log level. It would default to all NONE so the behavior would be as it is now. The writer would output the proper control string to set that color at the front of the log line and the control string to reset back to "none" at the end. A NONE value would not write anything extra. Overhead should be small, a couple of if statements, a control string lookup, and writing an extra 9 bytes. Obviously, I hope, this would only be for console logging.

I'll be prototyping this tomorrow (it's bedtime now). If this sounds like something that you would accept, I'll put in a pull request for you to look at. Your log4go repo seems to be the only fork that is being actively maintained so I'd rather add it to your's rather than fork it again.

@linmar
Copy link

linmar commented Dec 5, 2019

This would be a nice feature. Is it already available?

@amirbayan
Copy link

any update on this feature?

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

No branches or pull requests

3 participants