[openrtm-commit:02850] r876 - in trunk/OpenRTM-aist-Python/OpenRTM_aist: . ext/logger/fluentbit_stream
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 10月 2日 (月) 13:12:54 JST
Author: miyamoto
Date: 2017-10-02 13:12:54 +0900 (Mon, 02 Oct 2017)
New Revision: 876
Modified:
trunk/OpenRTM-aist-Python/OpenRTM_aist/LogstreamBase.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/LogstreamFile.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/SystemLogger.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/ext/logger/fluentbit_stream/FluentBit.py
Log:
[incompat,->RELENG_1_2] bug fix.
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/LogstreamBase.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/LogstreamBase.py 2017-09-29 06:01:19 UTC (rev 875)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/LogstreamBase.py 2017-10-02 04:12:54 UTC (rev 876)
@@ -123,7 +123,7 @@
#
# @endif
#
- def log(self, msg, level):
+ def log(self, msg, level, name):
return False
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/LogstreamFile.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/LogstreamFile.py 2017-09-29 06:01:19 UTC (rev 875)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/LogstreamFile.py 2017-10-02 04:12:54 UTC (rev 876)
@@ -201,6 +201,7 @@
# @param self
# @param msg¡¡¥í¥°½ÐÎϤ¹¤ëʸ»úÎó
# @param level ¥í¥°¥ì¥Ù¥ë
+ # @param name ¥í¥°¤Î½ÐÎÏ̾
# @return
#
# @else
@@ -210,31 +211,32 @@
# @param self
# @param msg
# @param level
+ # @param name
# @return
#
# @endif
#
- def log(self, msg, level):
+ def log(self, msg, level, name):
+ log = self.getLogger(name)
if level == OpenRTM_aist.Logger.FATAL:
- self.logger.log(logging.FATAL,msg)
+ log.log(logging.FATAL,msg)
elif level == OpenRTM_aist.Logger.ERROR:
- self.logger.error(msg)
+ log.error(msg)
elif level == OpenRTM_aist.Logger.WARN:
- self.logger.warning(msg)
+ log.warning(msg)
elif level == OpenRTM_aist.Logger.INFO:
- self.logger.info(msg)
+ log.info(msg)
elif level == OpenRTM_aist.Logger.DEBUG:
- self.logger.debug(msg)
+ log.debug(msg)
elif level == OpenRTM_aist.Logger.TRACE:
- self.logger.log(logging.TRACE,msg)
+ log.log(logging.TRACE,msg)
elif level == OpenRTM_aist.Logger.VERBOSE:
- self.logger.log(logging.VERBOSE,msg)
+ log.log(logging.VERBOSE,msg)
elif level == OpenRTM_aist.Logger.PARANOID:
- self.logger.log(logging.PARANOID,msg)
+ log.log(logging.PARANOID,msg)
else:
return False
-
- return True
+
##
@@ -306,7 +308,38 @@
self.handlers = []
return True
+ ##
+ # @if jp
+ # @brief ¥í¥¬¡¼¤Î¼èÆÀ
+ #
+ #
+ # @param self
+ # @param name ¥í¥°¤Î½ÐÎÏ̾
+ # @return¡¡¥í¥¬¡¼
+ #
+ # @else
+ # @brief
+ #
+ #
+ # @param self
+ # @param name
+ # @return
+ #
+ # @endif
+ #
+ def getLogger(self, name):
+ if name:
+ return logging.getLogger("file."+name)
+ else:
+ return self.logger
+
+
+
+
+
+ return True
+
def LogstreamFileInit():
OpenRTM_aist.LogstreamFactory.instance().addFactory("file",
OpenRTM_aist.LogstreamFile,
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2017-09-29 06:01:19 UTC (rev 875)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2017-10-02 04:12:54 UTC (rev 876)
@@ -2780,14 +2780,14 @@
# @endif
def getLogbuf(self,name="manager"):
if not OpenRTM_aist.toBool(self._config.getProperty("logger.enable"), "YES", "NO", True):
- return OpenRTM_aist.LogStream()
+ return OpenRTM_aist.LogStream().getLogger(name)
if self._rtcout is None:
self._rtcout = OpenRTM_aist.LogStream(name)
self._rtcout.setLogLevel(self._config.getProperty("logger.log_level"))
- return self._rtcout
+ return self._rtcout.getLogger(name)
else:
- return self._rtcout
+ return self._rtcout.getLogger(name)
##
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/SystemLogger.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/SystemLogger.py 2017-09-29 06:01:19 UTC (rev 875)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/SystemLogger.py 2017-10-02 04:12:54 UTC (rev 876)
@@ -21,6 +21,7 @@
import logging
import OpenRTM_aist
+import copy
@@ -181,7 +182,7 @@
-
+ self._logger_name = ""
self._mutex = threading.RLock()
self._loggerObj = []
self._log_enable = True
@@ -338,7 +339,7 @@
print("RTC_LOG : argument error")
return
for log in self._loggerObj:
- log.log(messages, LV)
+ log.log(messages, LV, self._logger_name)
self.release()
@@ -376,7 +377,7 @@
return
for log in self._loggerObj:
- log.log(messages, Logger.FATAL)
+ log.log(messages, Logger.FATAL, self._logger_name)
self.release()
@@ -414,7 +415,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.ERROR)
+ log.log(messages, Logger.ERROR, self._logger_name)
self.release()
@@ -456,7 +457,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.WARN)
+ log.log(messages, Logger.WARN, self._logger_name)
self.release()
@@ -498,7 +499,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.INFO)
+ log.log(messages, Logger.INFO, self._logger_name)
self.release()
@@ -540,7 +541,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.DEBUG)
+ log.log(messages, Logger.DEBUG, self._logger_name)
self.release()
@@ -583,7 +584,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.TRACE)
+ log.log(messages, Logger.TRACE, self._logger_name)
self.release()
@@ -626,7 +627,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.VERBOSE)
+ log.log(messages, Logger.VERBOSE, self._logger_name)
self.release()
@@ -670,12 +671,16 @@
for log in self._loggerObj:
- log.log(messages, Logger.PARANOID)
+ log.log(messages, Logger.PARANOID, self._logger_name)
self.release()
+ def getLogger(self, name):
+ syslogger = copy.copy(self)
+ syslogger._logger_name = name
+ return syslogger
+
-
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ext/logger/fluentbit_stream/FluentBit.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ext/logger/fluentbit_stream/FluentBit.py 2017-09-29 06:01:19 UTC (rev 875)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ext/logger/fluentbit_stream/FluentBit.py 2017-10-02 04:12:54 UTC (rev 876)
@@ -272,6 +272,7 @@
# @param self
# @param msg¡¡¥í¥°½ÐÎϤ¹¤ëʸ»úÎó
# @param level ¥í¥°¥ì¥Ù¥ë
+ # @param name ¥í¥°¤Î½ÐÎÏ̾
# @return
#
# @else
@@ -281,27 +282,29 @@
# @param self
# @param msg
# @param level
+ # @param name
# @return
#
# @endif
#
- def log(self, msg, level):
+ def log(self, msg, level, name):
+ log = self.getLogger(name)
if level == OpenRTM_aist.Logger.FATAL:
- self.logger.log(logging.FATAL,msg)
+ log.log(logging.FATAL,msg)
elif level == OpenRTM_aist.Logger.ERROR:
- self.logger.error(msg)
+ log.error(msg)
elif level == OpenRTM_aist.Logger.WARN:
- self.logger.warning(msg)
+ log.warning(msg)
elif level == OpenRTM_aist.Logger.INFO:
- self.logger.info(msg)
+ log.info(msg)
elif level == OpenRTM_aist.Logger.DEBUG:
- self.logger.debug(msg)
+ log.debug(msg)
elif level == OpenRTM_aist.Logger.TRACE:
- self.logger.log(logging.TRACE,msg)
+ log.log(logging.TRACE,msg)
elif level == OpenRTM_aist.Logger.VERBOSE:
- self.logger.log(logging.VERBOSE,msg)
+ log.log(logging.VERBOSE,msg)
elif level == OpenRTM_aist.Logger.PARANOID:
- self.logger.log(logging.PARANOID,msg)
+ log.log(logging.PARANOID,msg)
else:
return False
@@ -379,7 +382,32 @@
FluentBit.s_logger = None
return True
+ ##
+ # @if jp
+ # @brief ¥í¥¬¡¼¤Î¼èÆÀ
+ #
+ #
+ # @param self
+ # @param name ¥í¥°¤Î½ÐÎÏ̾
+ # @return¡¡¥í¥¬¡¼
+ #
+ # @else
+ # @brief
+ #
+ #
+ # @param self
+ # @param name
+ # @return
+ #
+ # @endif
+ #
+ def getLogger(self, name):
+ if name:
+ return logging.getLogger("fluent."+name)
+ else:
+ return self.logger
+
def FluentBitInit(mgr):
OpenRTM_aist.LogstreamFactory.instance().addFactory("fluentd",
FluentBit,
More information about the openrtm-commit
mailing list