From openrtm @ openrtm.org Thu Dec 6 16:11:46 2018 From: openrtm @ openrtm.org (openrtm @ openrtm.org) Date: Thu, 6 Dec 2018 16:11:46 +0900 Subject: [openrtm-commit:03385] r3453 - trunk/OpenRTM-aist/src/lib/rtm Message-ID: <20181206071146.3375FD60608@tmp.openrtm.org> Author: miyamoto Date: 2018-12-06 16:11:46 +0900 (Thu, 06 Dec 2018) New Revision: 3453 Modified: trunk/OpenRTM-aist/src/lib/rtm/PeriodicECSharedComposite.cpp Log: [compat, bugfix] Modified: trunk/OpenRTM-aist/src/lib/rtm/PeriodicECSharedComposite.cpp =================================================================== --- trunk/OpenRTM-aist/src/lib/rtm/PeriodicECSharedComposite.cpp 2018-11-26 00:03:27 UTC (rev 3452) +++ trunk/OpenRTM-aist/src/lib/rtm/PeriodicECSharedComposite.cpp 2018-12-06 07:11:46 UTC (rev 3453) @@ -160,7 +160,12 @@ { Member& member(*it); - size_t len = std::max(strlen(id), strlen(member.profile_->instance_name)); + size_t len = strlen(id); + if (len < strlen(member.profile_->instance_name)) + { + len = strlen(member.profile_->instance_name); + } + //size_t len = (std::max)(strlen(id), strlen(member.profile_->instance_name)); if (strncmp(id, member.profile_->instance_name, len)) { ++it; From openrtm @ openrtm.org Thu Dec 6 17:40:59 2018 From: openrtm @ openrtm.org (openrtm @ openrtm.org) Date: Thu, 6 Dec 2018 17:40:59 +0900 Subject: [openrtm-commit:03386] r3454 - trunk/OpenRTM-aist/src/lib/rtm Message-ID: <20181206084059.67139D60604@tmp.openrtm.org> Author: miyamoto Date: 2018-12-06 17:40:59 +0900 (Thu, 06 Dec 2018) New Revision: 3454 Modified: trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.h Log: [incompat] Modified: trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h =================================================================== --- trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h 2018-12-06 07:11:46 UTC (rev 3453) +++ trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h 2018-12-06 08:40:59 UTC (rev 3454) @@ -57,6 +57,7 @@ "logger.log_level", "INFO", "logger.stream_lock", "NO", "logger.master_logger", "", + "logger.escape_sequence_enable", "NO", "module.conf_path", "", "module.load_path", "", "naming.enable", "YES", Modified: trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp =================================================================== --- trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp 2018-12-06 07:11:46 UTC (rev 3453) +++ trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp 2018-12-06 08:40:59 UTC (rev 3454) @@ -1467,6 +1467,8 @@ // Log stream mutex locking mode coil::toBool(m_config["logger.stream_lock"], "enable", "disable", false) ? rtclog.enableLock() : rtclog.disableLock(); + coil::toBool(m_config["logger.escape_sequence_enable"], "YES", "NO", false) ? + rtclog.enableEscapeSequence() : rtclog.disableEscapeSequence(); // File Logstream init initLogstreamFile(); Modified: trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp =================================================================== --- trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp 2018-12-06 07:11:46 UTC (rev 3453) +++ trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp 2018-12-06 08:40:59 UTC (rev 3454) @@ -48,7 +48,7 @@ m_name(name), m_dateFormat("%b %d %H:%M:%S.%Q"), m_clock(&coil::ClockManager::instance().getClock("system")), - m_msEnable(0), m_usEnable(0) + m_msEnable(0), m_usEnable(0), m_esEnable(0) { setLevel(Manager::instance().getLogLevel().c_str()); coil::Properties& prop(Manager::instance().getConfig()); @@ -60,6 +60,8 @@ { setClockType(prop["logger.clock_type"]); } + coil::toBool(prop["logger.escape_sequence_enable"], "YES", "NO", false) ? + enableEscapeSequence() : disableEscapeSequence(); } Logger::Logger(LogStreamBuf* streambuf) @@ -68,7 +70,7 @@ m_name("unknown"), m_dateFormat("%b %d %H:%M:%S.%Q"), m_clock(&coil::ClockManager::instance().getClock("system")), - m_msEnable(0), m_usEnable(0) + m_msEnable(0), m_usEnable(0), m_esEnable(0) { setDateFormat(m_dateFormat.c_str()); } @@ -127,23 +129,29 @@ * @endif */ 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"; - } + { + if (m_esEnable) + { + 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 + ": "; + if (m_esEnable) + { + *this << "\x1b[0m"; + } + } /*! * @if jp @@ -216,4 +224,44 @@ return RTL_SILENT; } + /*! + * @if jp + * + * @brief エスケープシーケンスの有効にする + * + * + * @else + * + * @brief + * + * + * + * + * @endif + */ + void Logger::enableEscapeSequence() + { + m_esEnable = true; + } + + /*! + * @if jp + * + * @brief エスケープシーケンスの無効にする + * + * + * @else + * + * @brief + * + * + * + * + * @endif + */ + void Logger::disableEscapeSequence() + { + m_esEnable = false; + } + }; // namespace RTC Modified: trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.h =================================================================== --- trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.h 2018-12-06 07:11:46 UTC (rev 3453) +++ trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.h 2018-12-06 08:40:59 UTC (rev 3454) @@ -321,6 +321,43 @@ */ void setName(const char* name); + /*! + * @if jp + * + * @brief エスケープシーケンスを有効にする + * + * + * + * @else + * + * @brief + * + * + * + * + * + * @endif + */ + void enableEscapeSequence(); + /*! + * @if jp + * + * @brief エスケープシーケンスを無効にする + * + * + * + * @else + * + * @brief + * + * + * + * + * + * @endif + */ + void disableEscapeSequence(); + protected: /*! * @if jp @@ -378,6 +415,8 @@ */ int strToLevel(const char* level); + + private: std::string m_name; std::string m_dateFormat; @@ -385,6 +424,7 @@ static const char* m_levelString[]; int m_msEnable; int m_usEnable; + bool m_esEnable; }; From openrtm @ openrtm.org Thu Dec 6 18:53:23 2018 From: openrtm @ openrtm.org (openrtm @ openrtm.org) Date: Thu, 6 Dec 2018 18:53:23 +0900 Subject: [openrtm-commit:03387] r3455 - branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm Message-ID: <20181206095323.E20D9D605CD@tmp.openrtm.org> Author: miyamoto Date: 2018-12-06 18:53:23 +0900 (Thu, 06 Dec 2018) New Revision: 3455 Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Manager.cpp branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/SystemLogger.h Log: [merge] r3454 has been merged from trunk. Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h =================================================================== --- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h 2018-12-06 08:40:59 UTC (rev 3454) +++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h 2018-12-06 09:53:23 UTC (rev 3455) @@ -56,6 +56,7 @@ "logger.log_level", "INFO", "logger.stream_lock", "NO", "logger.master_logger", "", + "logger.escape_sequence_enable", "NO", "module.conf_path", "", "module.load_path", "", "naming.enable", "YES", Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Manager.cpp =================================================================== --- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Manager.cpp 2018-12-06 08:40:59 UTC (rev 3454) +++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Manager.cpp 2018-12-06 09:53:23 UTC (rev 3455) @@ -1432,6 +1432,8 @@ // Log stream mutex locking mode coil::toBool(m_config["logger.stream_lock"], "enable", "disable", false) ? rtclog.enableLock() : rtclog.disableLock(); + coil::toBool(m_config["logger.escape_sequence_enable"], "YES", "NO", false) ? + rtclog.enableEscapeSequence() : rtclog.disableEscapeSequence(); // File Logstream init initLogstreamFile(); Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp =================================================================== --- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp 2018-12-06 08:40:59 UTC (rev 3454) +++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp 2018-12-06 09:53:23 UTC (rev 3455) @@ -44,7 +44,7 @@ m_name(name), m_dateFormat("%b %d %H:%M:%S.%Q"), m_clock(&coil::ClockManager::instance().getClock("system")), - m_msEnable(0), m_usEnable(0) + m_msEnable(0), m_usEnable(0), m_esEnable(0) { setLevel(Manager::instance().getLogLevel().c_str()); coil::Properties& prop(Manager::instance().getConfig()); @@ -56,6 +56,8 @@ { setClockType(prop["logger.clock_type"]); } + coil::toBool(prop["logger.escape_sequence_enable"], "YES", "NO", false) ? + enableEscapeSequence() : disableEscapeSequence(); } Logger::Logger(LogStreamBuf* streambuf) @@ -64,7 +66,7 @@ m_name("unknown"), m_dateFormat("%b %d %H:%M:%S.%Q"), m_clock(&coil::ClockManager::instance().getClock("system")), - m_msEnable(0), m_usEnable(0) + m_msEnable(0), m_usEnable(0), m_esEnable(0) { setDateFormat(m_dateFormat.c_str()); } @@ -124,21 +126,27 @@ */ void Logger::header(int level) { - const char* color[] = + if (m_esEnable) { - "\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]; + 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"; + if (m_esEnable) + { + *this << "\x1b[0m"; + } } /*! @@ -221,4 +229,44 @@ return RTL_SILENT; } + /*! + * @if jp + * + * @brief ���������ץ������󥹤�ͭ���ˤ��� + * + * + * @else + * + * @brief + * + * + * + * + * @endif + */ + void Logger::enableEscapeSequence() + { + m_esEnable = true; + } + + /*! + * @if jp + * + * @brief ���������ץ������󥹤�̵���ˤ��� + * + * + * @else + * + * @brief + * + * + * + * + * @endif + */ + void Logger::disableEscapeSequence() + { + m_esEnable = false; + } + }; // namespace RTC Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/SystemLogger.h =================================================================== --- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/SystemLogger.h 2018-12-06 08:40:59 UTC (rev 3454) +++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/SystemLogger.h 2018-12-06 09:53:23 UTC (rev 3455) @@ -318,6 +318,42 @@ * @endif */ void setName(const char* name); + /*! + * @if jp + * + * @brief ���������ץ������󥹤�ͭ���ˤ��� + * + * + * + * @else + * + * @brief + * + * + * + * + * + * @endif + */ + void enableEscapeSequence(); + /*! + * @if jp + * + * @brief ���������ץ������󥹤�̵���ˤ��� + * + * + * + * @else + * + * @brief + * + * + * + * + * + * @endif + */ + void disableEscapeSequence(); protected: /*! @@ -383,6 +419,7 @@ static const char* m_levelString[]; int m_msEnable; int m_usEnable; + bool m_esEnable; };