22 import logging.handlers
86 elif lv ==
"PARANOID":
87 return Logger.PARANOID
116 if logger
is not None:
135 logging.PARANOID = logging.DEBUG - 3
136 logging.VERBOSE = logging.DEBUG - 2
137 logging.TRACE = logging.DEBUG - 1
138 logging.FATAL = logging.ERROR + 1
140 logging.addLevelName(logging.PARANOID,
"PARANOID")
141 logging.addLevelName(logging.VERBOSE,
"VERBOSE")
142 logging.addLevelName(logging.TRACE,
"TRACE")
143 logging.addLevelName(logging.FATAL,
"FATAL")
146 logging.root.setLevel([logging.NOTSET, 159 formatter = logging.Formatter(
'%(asctime)s %(name)s %(levelname)s %(message)s')
161 if mode
is None or mode ==
"FILE":
163 logger._fhdlr = logging.FileHandler(fileName)
165 logger._fhdlr = logging.FileHandler(
'rtcsystem.log')
167 mhdlr = logging.handlers.MemoryHandler(1024,logging.NOTSET, logger._fhdlr)
168 logger._fhdlr.setFormatter(formatter)
170 logging.getLogger(
"").setLevel(logging.NOTSET)
172 elif mode ==
"STDOUT":
173 ch = logging.StreamHandler()
174 ch.setLevel(logging.NOTSET)
175 ch.setFormatter(formatter)
180 init = staticmethod(init)
238 formatter = logging.Formatter(
'%(asctime)s %(name)s %(levelname)s %(message)s')
240 if mode
is None or mode ==
"FILE":
242 self.
_fhdlr = logging.FileHandler(fileName)
244 self.
_fhdlr = logging.FileHandler(
'rtcsystem.log')
246 mhdlr = logging.handlers.MemoryHandler(1024,logging.NOTSET, self.
_fhdlr)
247 self._fhdlr.setFormatter(formatter)
250 elif mode.lower() ==
"stdout":
251 ch = logging.StreamHandler()
252 ch.setLevel(logging.NOTSET)
253 ch.setFormatter(formatter)
272 if sys.version_info[0:3] >= (2, 4, 0):
273 return traceback.format_exc()
275 _exc_list = traceback.format_exception(*sys.exc_info())
276 _exc_str =
"".join(_exc_list)
279 print_exception = staticmethod(print_exception)
339 self._loggerObj.addHandler(*args)
357 self.logger.setLevel(logging.INFO)
358 elif level ==
"FATAL":
359 self.logger.setLevel(logging.FATAL)
360 elif level ==
"ERROR":
361 self.logger.setLevel(logging.ERROR)
362 elif level ==
"WARN":
363 self.logger.setLevel(logging.WARNING)
364 elif level ==
"DEBUG":
365 self.logger.setLevel(logging.DEBUG)
366 elif level ==
"SILENT":
367 self.logger.setLevel(logging.NOTSET)
368 elif level ==
"TRACE":
369 self.logger.setLevel(logging.TRACE)
370 elif level ==
"VERBOSE":
371 self.logger.setLevel(logging.VERBOSE)
372 elif level ==
"PARANOID":
373 self.logger.setLevel(logging.PARANOID)
375 self.logger.setLevel(logging.INFO)
490 print "RTC_LOG : argument error" 493 self.logger.log(LV,messages)
526 print "RTC_FATAL : argument error" 529 self.logger.log(logging.FATAL,messages)
562 print "RTC_ERROR : argument error" 565 self.logger.error(messages)
602 print "RTC_WARN : argument error" 605 self.logger.warning(messages)
642 print "RTC_INFO : argument error" 645 self.logger.info(messages)
682 print "RTC_DEBUG : argument error" 685 self.logger.debug(messages)
723 print "RTC_TRACE : argument error" 726 self.logger.log(logging.TRACE,messages)
764 print "RTC_VERBOSE : argument error" 767 self.logger.log(logging.VERBOSE,messages)
806 print "RTC_PARANOID : argument error" 809 self.logger.log(logging.PARANOID,messages)
def addHandler(self, args)
def RTC_DEBUG(self, msg, opt=None)
Debug level log output macro.
def RTC_TRACE(self, msg, opt=None)
Trace level log output macro.
def RTC_ERROR(self, msg, opt=None)
Error log output macro.
def RTC_PARANOID(self, msg, opt=None)
Paranoid level log output macro.
def RTC_VERBOSE(self, msg, opt=None)
Verbose level log output macro.
def RTC_WARN(self, msg, opt=None)
Warning log output macro.
def RTC_FATAL(self, msg, opt=None)
Error log output macro.
def printf(self, fmt)
Formatted output like printf.
def strToLogLevel(self, lv)
def __init__(self, args)
constructor.
def RTC_LOG(self, LV, msg, opt=None)
Log output macro.
def setLogLock(self, lock)
def print_exception()
Print exception information.
def __init__(self, args)
constructor.
def setLogLevel(self, level)
def RTC_INFO(self, msg, opt=None)
Infomation level log output macro.
def __del__(self)
destractor.
def addHandler(self, args)