From 42e7cbc71d24fb80d6275fa692cfe4f44110e023 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 28 Apr 2025 15:26:33 -0500 Subject: [PATCH] Add color to the softIoc verbose output --- modules/database/src/std/softIoc/softMain.cpp | 46 +++++++++---------- modules/libcom/src/iocsh/iocsh.cpp | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/modules/database/src/std/softIoc/softMain.cpp b/modules/database/src/std/softIoc/softMain.cpp index 4c1b49a2b..9c030d2a2 100644 --- a/modules/database/src/std/softIoc/softMain.cpp +++ b/modules/database/src/std/softIoc/softMain.cpp @@ -51,6 +51,14 @@ namespace { bool verbose = false; +enum coloration {NONE, CMD, REM}; + +void verbose_out(coloration color, const std::string& message) { + if (!verbose) return; + const char *ansi[] = {ANSI_ESC_RESET, ANSI_ESC_BOLD, ANSI_ESC_BLUE}; + std::cout << ansi[color] << message << ansi[NONE] << std::endl; +} + static void exitSubroutine(subRecord *precord) { epicsExitLater((precord->a == 0.0) ? EXIT_SUCCESS : EXIT_FAILURE); } @@ -109,13 +117,11 @@ void lazy_dbd(const std::string& dbd_file) { if(lazy_dbd_loaded) return; lazy_dbd_loaded = true; - if (verbose) - std::cout<<"dbLoadDatabase(\""<