1
2
3
4
5
6
7
8 from rdBase import EnableLog,DisableLog,AttachFileToLog,LogMessage
9 import sys,traceback
10
11 _levels=['rdApp.debug','rdApp.info','rdApp.warning','rdApp.error']
12 DEBUG=0
13 INFO=1
14 WARNING=2
15 ERROR=3
16 CRITICAL=3
17
19 - def logIt(self,dest,msg,*args,**kwargs):
20 if(args):
21 msg = msg%args
22 LogMessage(dest,msg+'\n')
23 if kwargs.get('exc_info',False):
24 exc_type,exc_val,exc_tb = sys.exc_info()
25 if exc_type:
26 LogMessage(dest,'\n')
27 txt = ''.join(traceback.format_exception(exc_type,exc_val,exc_tb))
28 LogMessage(dest,txt)
29 - def debug(self,msg,*args,**kwargs):
30 self.logIt('rdApp.debug','DEBUG: '+msg,*args,**kwargs)
31 - def error(self,msg,*args,**kwargs):
32 self.logIt('rdApp.error','ERROR: '+msg,*args,**kwargs)
33 - def info(self,msg,*args,**kwargs):
34 self.logIt('rdApp.info','INFO: '+msg,*args,**kwargs)
35 - def warning(self,msg,*args,**kwargs):
36 self.logIt('rdApp.warning','WARNING: '+msg,*args,**kwargs)
38 self.logIt('rdApp.error','CRITICAL: '+msg,*args,**kwargs)
39
46