(4 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 3 years, 1 month ago

Sounds COOOOOOOL!

Link | Reply
Current rating: 5

Danielle Perez 3 years, 1 month 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

Case Studies Analysis 1 week, 5 days ago

I personally like your post, you have shared good article. It will help me in great deal.

Link | Reply
Currently unrated

harding barry 2 days, 3 hours ago

I personally like your post,

Link | Reply
Currently unrated

New Comment

required

required (not published)

optional

R&D 100

Recent Blog Posts

Using our new clang-format Style

5 months, 1 week ago

Steady State Algorithm Change

1 year, 2 months ago

Making an App inherit from an App

1 year, 2 months ago

Changing a published API (Deprecation)

1 year, 2 months ago

DiscreteMaterial Objects

1 year, 5 months ago

Recent Posts

Archive

2017
2016
2015
2014

Tags

Authors

Feeds

RSS / Atom