loglevel = warning
-def setDebug():
+def setDebug(logfile=None):
global loglevel
- logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
- level=logging.DEBUG)
+ if logfile:
+ logging.basicConfig(filename=logfile,
+ format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.DEBUG)
+ else:
+ logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.DEBUG)
loglevel = debug
logging.info('start Debug %s', loglevel)
-def setVerbose():
+def setVerbose(logfile=None):
global loglevel
- logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
- level=logging.INFO)
+ if logfile:
+ logging.basicConfig(filename=logfile,
+ format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.INFO)
+ else:
+ logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.INFO)
loglevel = info
logging.info('start Verbose %s', loglevel)
-def setRelease():
+def setRelease(logfile=None):
global loglevel
- logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
- level=logging.WARNING)
+ if logfile:
+ logging.basicConfig(filename=logfile,
+ format='%(funcName)s[%(lineno)d] %(message)s',
+ level=logging.WARNING)
+ else:
+ logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
+ level=logging.WARNING)
loglevel = warning
logging.warning('start Release %s', loglevel)
-def setUnitTests():
+def setUnitTests(logfile=None):
global loglevel
- logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
- level=logging.CRITICAL)
+ if logfile:
+ logging.basicConfig(filename=logfile,
+ format='%(funcName)s[%(lineno)d] %(message)s',
+ level=logging.CRITICAL)
+ else:
+ logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
+ level=logging.CRITICAL)
loglevel = critical
logging.critical('start UnitTests %s', loglevel)
-def setPerfTests():
+def setPerfTests(logfile=None):
global loglevel
- logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
- level=logging.CRITICAL)
+ if logfile:
+ logging.basicConfig(filename=logfile,
+ format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.CRITICAL)
+ else:
+ logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.CRITICAL)
loglevel = critical
logging.info('start PerfTests %s', loglevel)
#self.initDefaut()
self.initDialog(self.defaut)
- def setLogVerbosity(self):
+ def setLogVerbosity(self, logfile):
from blocFissure.gmu import initLog # le mode de log s'initialise une seule fois
print "setLogVerbosity"
index = self.ui.cb_log.currentIndex()
print index
if index == 0:
- initLog.setRelease()
+ initLog.setRelease(logfile)
elif index == 1:
- initLog.setVerbose()
+ initLog.setVerbose(logfile)
elif index == 2:
- initLog.setDebug()
+ initLog.setDebug(logfile)
def sauver(self):
if not(NOK):
self.writeDefault(dico)
self.ui.lb_calcul.show()
- self.setLogVerbosity()
+ logfile=os.path.join(dico['reptrav'], dico['nomres']+".log")
+ self.setLogVerbosity(logfile)
from blocFissure.gmu import geomsmesh # après intialisation log dans setLogVerbosity
from blocFissure.gmu.casStandard import casStandard # après intialisation log dans setLogVerbosity
execInstance = casStandard(dico)