mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 09:20:34 +05:00
informations de log
This commit is contained in:
parent
13469a2390
commit
8eb3c73cbd
@ -19,18 +19,21 @@
|
||||
#
|
||||
"""Lancement des cas-tests de blocFissure"""
|
||||
|
||||
import traceback
|
||||
|
||||
import logging
|
||||
import os
|
||||
import tempfile
|
||||
import traceback
|
||||
|
||||
from blocFissure.gmu import initLog
|
||||
from blocFissure.gmu.casStandard import casStandard
|
||||
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
#initLog.setDebug()
|
||||
#initLog.setVerbose()
|
||||
#initLog.setRelease()
|
||||
#initLog.setPerfTests()
|
||||
LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log")
|
||||
#initLog.setDebug(LOGFILE) # debug = 10
|
||||
initLog.setVerbose(LOGFILE) # info = 20
|
||||
#initLog.setRelease(LOGFILE) # warning = 30
|
||||
#initLog.setPerfTests(LOGFILE) # critical = 50
|
||||
#initLog.setAlways(LOGFILE) # critical = 50
|
||||
|
||||
# ---tous les cas en séquence, ou les cas sélectionnés ...
|
||||
TORUNOK = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0] # OK
|
||||
@ -238,6 +241,7 @@ def calcul_cas (n_cas, cas, d_aux, ligne):
|
||||
nom = cas.nomProbleme
|
||||
texte_a = "\n=== Exécution du cas n° {}, '{}'".format(n_cas,nom)
|
||||
logging.critical(ligne+texte_a)
|
||||
|
||||
try:
|
||||
ok_maillage = cas.executeProbleme()
|
||||
except:
|
||||
@ -246,6 +250,7 @@ def calcul_cas (n_cas, cas, d_aux, ligne):
|
||||
if not ok_maillage:
|
||||
texte = "Problème avec le cas n° {}, '{}'\n".format(n_cas,nom)
|
||||
print(ligne)
|
||||
|
||||
return ok_maillage, texte
|
||||
#=============================================================
|
||||
def calcul_tout (l_problemes, d_aux):
|
||||
|
@ -34,12 +34,14 @@ def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
|
||||
|
||||
for n_edges, edges in enumerate(listEdges):
|
||||
|
||||
idf = idFacesDebouchantes[n_edges] # indice de face débouchante (facesPipePeau)
|
||||
# idf = indice de face débouchante (facesPipePeau) ; idf vaut 0 ou 1
|
||||
idf = idFacesDebouchantes[n_edges]
|
||||
logging.info("idf: %d", idf)
|
||||
if idf >= 0:
|
||||
if ( idf >= 0 ):
|
||||
gptdsk = list()
|
||||
if idf > 0: # idf vaut 0 ou 1
|
||||
idf = -1 # si idf vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face)
|
||||
# si idf vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face)
|
||||
if ( idf > 0 ):
|
||||
idf = -1
|
||||
centre = ptEdgeFond[idFillingFromBout[n_edges]][idf]
|
||||
name = "centre_{}".format(idf)
|
||||
geomPublish(initLog.debug, centre, name)
|
||||
@ -50,7 +52,7 @@ def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
|
||||
edgesCirc = list()
|
||||
for grpEdgesCirc in grpsEdgesCirc:
|
||||
edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False)
|
||||
logging.info("edgesCirc: %s", edgesCirc)
|
||||
logging.debug("edgesCirc: %s", edgesCirc)
|
||||
|
||||
for i_aux, edge in enumerate(edges):
|
||||
extrems = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True)
|
||||
|
@ -30,13 +30,13 @@ error = 40
|
||||
critical = 50
|
||||
always = 100
|
||||
|
||||
filelog = os.path.join(tempfile.gettempdir(),"blocFissure.log")
|
||||
LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log")
|
||||
|
||||
loglevel = warning
|
||||
LOG_LEVEL = warning
|
||||
|
||||
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s', \
|
||||
level=logging.WARNING, \
|
||||
filename=filelog, filemode='w')
|
||||
filename=LOGFILE, filemode='w')
|
||||
ch = None
|
||||
fh = None
|
||||
|
||||
@ -64,49 +64,58 @@ def setLogger(logfile, level, formatter):
|
||||
|
||||
def setDebug(logfile=None):
|
||||
"""setDebug"""
|
||||
global loglevel
|
||||
loglevel = debug
|
||||
global LOG_LEVEL
|
||||
LOG_LEVEL = debug
|
||||
level = logging.DEBUG
|
||||
formatter = logging.Formatter('%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s')
|
||||
setLogger(logfile, level, formatter)
|
||||
logging.info('start Debug %s', loglevel)
|
||||
logging.info('start Debug %s', LOG_LEVEL)
|
||||
|
||||
def setVerbose(logfile=None):
|
||||
"""setVerbose"""
|
||||
global loglevel
|
||||
loglevel = info
|
||||
global LOG_LEVEL
|
||||
LOG_LEVEL = info
|
||||
level = logging.INFO
|
||||
formatter = logging.Formatter('%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s')
|
||||
setLogger(logfile, level, formatter)
|
||||
logging.info('start Verbose %s', loglevel)
|
||||
logging.info('start Verbose %s', LOG_LEVEL)
|
||||
|
||||
def setRelease(logfile=None):
|
||||
"""setRelease"""
|
||||
global loglevel
|
||||
loglevel = warning
|
||||
global LOG_LEVEL
|
||||
LOG_LEVEL = warning
|
||||
level = logging.WARNING
|
||||
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
||||
setLogger(logfile, level, formatter)
|
||||
logging.warning('start Release %s', loglevel)
|
||||
logging.warning('start Release %s', LOG_LEVEL)
|
||||
|
||||
def setUnitTests(logfile=None):
|
||||
"""setUnitTests"""
|
||||
global loglevel
|
||||
loglevel = critical
|
||||
global LOG_LEVEL
|
||||
LOG_LEVEL = critical
|
||||
level = logging.CRITICAL
|
||||
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
||||
setLogger(logfile, level, formatter)
|
||||
logging.critical('start UnitTests %s', loglevel)
|
||||
logging.critical('start UnitTests %s', LOG_LEVEL)
|
||||
|
||||
def setPerfTests(logfile=None):
|
||||
"""setPerfTests"""
|
||||
global loglevel
|
||||
loglevel = critical
|
||||
global LOG_LEVEL
|
||||
LOG_LEVEL = critical
|
||||
level = logging.CRITICAL
|
||||
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
||||
setLogger(logfile, level, formatter)
|
||||
logging.info('start PerfTests %s', loglevel)
|
||||
logging.info('start PerfTests %s', LOG_LEVEL)
|
||||
|
||||
def setAlways(logfile=None):
|
||||
"""setAlways"""
|
||||
global LOG_LEVEL
|
||||
LOG_LEVEL = always
|
||||
level = logging.CRITICAL
|
||||
formatter = logging.Formatter('%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s')
|
||||
setLogger(logfile, level, formatter)
|
||||
logging.info('start Always %s', LOG_LEVEL)
|
||||
|
||||
def getLogLevel():
|
||||
"""getLogLevel"""
|
||||
return loglevel
|
||||
return LOG_LEVEL
|
||||
|
Loading…
Reference in New Issue
Block a user