(2 comments)

Highlighting or coloring output in MOOSE is now easy to use. There are several color macro names that can be inserted into any stream object.

_console 
   << "The following value is very important: " 
   << COLOR_GREEN << _some_value << COLOR_DEFAULT << '\n';
  • When using the color macros it is important to always switch the color back to the default using COLOR_DEFAULT before completing your stream output.
  • MOOSE automatically disables color when the terminal type cannot be detected.
  • By default mooseError() and mooseWarning() messages will be colored on your terminal.
  • To manually disable coloring simply use the --no-color option on the command line when running your application.
  • The following colors macros are available for general use:
 COLOR_BLACK
 COLOR_RED
 COLOR_GREEN
 COLOR_YELLOW
 COLOR_BLUE
 COLOR_MAGENTA
 COLOR_CYAN
 COLOR_WHITE
 COLOR_DEFAULT
Current rating: 5

Comments

Lei Zhao 2 years, 10 months ago

Sounds COOOOOOOL!

Link | Reply
Current rating: 5

Danielle Perez 2 years, 10 months ago

I suggest to let the user specify the use_color option within the input file unless you guys are planning on fixing the issue where the color does not get printed when the console output is sent to stdlog and stderr files. I always save my log file when doing BISON validation so I can look through the convergence history, it is hard to figure out what is going on when the "color" is printed out as "ESC[32m9.965709e+01ESC[39m". It seems with this new and improved color system that you can no longer turn off the color within the input file. If there is a way to do it, please let me know.

Thanks!

Danielle

Link | Reply
Currently unrated

New Comment

required

required (not published)

optional

R&D 100

Recent Blog Posts

Using our new clang-format Style

1 month, 2 weeks ago

Steady State Algorithm Change

10 months, 3 weeks ago

Making an App inherit from an App

11 months ago

Changing a published API (Deprecation)

11 months, 1 week ago

DiscreteMaterial Objects

1 year, 1 month ago

Recent Posts

Archive

2017
2016
2015
2014

Tags

Authors

Feeds

RSS / Atom