Adding colored text output to iocsh output

Registered by Keenan Lang on 2014-01-07

The IOC shell application displays a lot of information very densly. When reading through this output, it is frequently difficult to find the information you are looking for quickly. This is especially noticeable when an error occurs during configuration/startup but the IOC is still successfully able to run iocBoot, no visual clue indicates that something went wrong and when it is realized there was an issue, the error is still very difficult to find in a large group of lines that look exactly alike. It would be useful to be able to have the option to have the IOC shell able to output colorized text.

An environment variable such as "EPICS_USE_COLOR" could switch on and off the color output. On unix systems, ANSI escape codes can be sent to the terminal to switch text color and on Windows the core Windows library provides support. The POSIX function 'isatty' (or on windows '_isatty') would make sure it is only outputting color to a terminal, so that output redirection would not result in a file containing all the escape commands.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Sprints

Whiteboard

The linked branch contains a working version of the idea for Linux soft IOC's. However, it goes a step further and allows for custom colors to be set by the startup script like so:

epicsEnvSet("RED", "2");
epicsEnvSet("GREEN", "3");
epicsEnvSet("BLUE", "5");

epicsEnvSet("EPICS_USE_COLOR_TERMINAL", "YES");
epicsEnvSet("EPICS_RECORD_NAME_COLOR", "$(BLUE)");

epicsEnvSet("EPICS_ERROR_COLOR", "$(RED)");
epicsEnvSet("EPICS_HELP_COLOR", "$(GREEN)");
epicsEnvSet("EPICS_COMMENT_COLOR", "$(GREEN)");

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.