[openrtm-commit:01608] r2670 - trunk/OpenRTM-aist/src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2015年 10月 20日 (火) 11:30:42 JST


Author: n-ando
Date: 2015-10-20 11:30:42 +0900 (Tue, 20 Oct 2015)
New Revision: 2670

Modified:
   trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp
Log:
[compat,->RELENG1_1] Now log messsages are colored. refs #3344

Modified: trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp	2015-09-28 07:55:07 UTC (rev 2669)
+++ trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp	2015-10-20 02:30:42 UTC (rev 2670)
@@ -124,7 +124,21 @@
    */
   void Logger::header(int level)
   {
+    const char* color[] =
+      {
+        "\x1b[0m",         // SLILENT  (none)
+        "\x1b[0m\x1b[31m", // FATAL    (red)
+        "\x1b[0m\x1b[35m", // ERROR    (magenta)
+        "\x1b[0m\x1b[33m", // WARN     (yellow)
+        "\x1b[0m\x1b[34m", // INFO     (blue)
+        "\x1b[0m\x1b[32m", // DEBUG    (green)
+        "\x1b[0m\x1b[36m", // TRACE    (cyan)
+        "\x1b[0m\x1b[39m", // VERBOSE  (default)
+        "\x1b[0m\x1b[37m"  // PARANOID (white)
+      };
+    *this << color[level];
     *this << getDate() + m_levelString[level] + m_name + ": ";
+    *this << "\x1b[0m";
   }
 
   /*!



More information about the openrtm-commit mailing list