Skip to content

Support for Ansi colors in console logger #177

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

Merged
merged 3 commits into from
Jun 16, 2020
Merged

Support for Ansi colors in console logger #177

merged 3 commits into from
Jun 16, 2020

Conversation

ddsharpe
Copy link
Member

Adding color to the console logger makes it easier to see key data in the user's console.

} else {
// check logging properties to see if the user wants to disable color output
String flag = LogManager.getLogManager().getProperty("java.util.logging.ConsoleHandler.color");
if (flag != null && flag.equalsIgnoreCase("false")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just put the property on your ConsoleFormatter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no reason, other than to simplify the interface for the user. The user only knows about the ConsoleHandler (within the logging.properties file), and the formatter is injected into all ConsoleHandlers. The Handler seemed like the right place for the setting.

}

private String replaceColorTokens(String text) {
//Pattern pattern = Pattern.compile("\\[([a-z]+)\\]");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented line.

Why not put this up in the class variables so it is only done once?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@rakillen rakillen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest changes work with Windows.

@ddsharpe ddsharpe merged commit e1db1e8 into master Jun 16, 2020
@ddsharpe ddsharpe deleted the ansi-colors branch June 16, 2020 14:20
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

Successfully merging this pull request may close these issues.

4 participants