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