]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: bug 14147 remove traces
authorprascle <prascle>
Mon, 22 Jan 2007 13:51:27 +0000 (13:51 +0000)
committerprascle <prascle>
Mon, 22 Jan 2007 13:51:27 +0000 (13:51 +0000)
bin/addToKillList.py
bin/killSalomeWithPort.py
bin/launchConfigureParser.py
bin/runSalome.py
src/Container/SALOME_Container.py
src/Container/SALOME_ContainerPy.py
src/NamingService/SALOME_NamingService.cxx
src/SALOMELocalTrace/utilities.h
src/Utils/SALOME_utilities.py

index 390ac2aaad41d7f2a6850cc43140ec35d240c0d5..f29cccef74667767068d50a23075504f225ac733 100755 (executable)
@@ -20,6 +20,7 @@
 # 
 
 import os, sys, pickle, string, signal
+from launchConfigureParser import verbose
 
 ########## adds to the kill list of SALOME one more process ##########
 
@@ -43,7 +44,7 @@ def findFileDict():
         except:
             pass
         pass
-    print "myport = ", my_port
+    if verbose(): print "myport = ", my_port
     return my_port
     
 def addToKillList(command_pid, command):
@@ -60,7 +61,7 @@ def addToKillList(command_pid, command):
         
     already_in=0
     for process_id in process_ids:
-        print process_id
+        if verbose(): print process_id
         for pid, cmd in process_id.items():
             #print "see process %s : %s"% (pid, cmd[0])
            if pid == command_pid:
@@ -111,5 +112,5 @@ def killList():
 
 
 if __name__ == "__main__":
-    print sys.argv
+    if verbose(): print sys.argv
     addToKillList(sys.argv[1], sys.argv[2])
index 60e166d15e2ea2c494335b8b136d1b9134787268..7a006f845184281202f2af1286a9882ba65a39ac 100755 (executable)
@@ -20,6 +20,7 @@
 # 
 
 import os, sys, pickle, signal, commands
+from launchConfigureParser import verbose
 
 def getPiDict(port,appname='salome',full=True):
     from Utils_Identity import getShortHostName
@@ -96,7 +97,7 @@ def killMyPort(port):
                 for field in prc.split(" ") :
                     if field == "omniNames" :
                         if pidfield != "egrep" :
-                            print 'stop process '+pidfield+' : omniNames'
+                            if verbose(): print 'stop process '+pidfield+' : omniNames'
                             os.system('kill -9 '+pidfield)
                     pidfield = field
         except:
@@ -108,11 +109,11 @@ def killMyPort(port):
             for process_id in process_ids:
 
                 for pid, cmd in process_id.items():
-                    print "stop process %s : %s"% (pid, cmd[0])
+                    if verbose(): print "stop process %s : %s"% (pid, cmd[0])
                     try:
                         os.kill(int(pid),signal.SIGKILL)
                     except:
-                        print "  ------------------ process %s : %s not found"% (pid, cmd[0])
+                        if verbose(): print "  ------------------ process %s : %s not found"% (pid, cmd[0])
                         pass
                 pass
         except:
index 0f7ce8b4fec8e3dd37787d670d1377944f0fe559..cddd4b5202140d2d355b5f509234698786ba3527 100755 (executable)
@@ -140,6 +140,30 @@ def userFile():
             last_file = file
     return last_file
 
+# --
+
+_verbose = None
+
+def verbose():
+    global _verbose
+    # verbose has already been called
+    if _verbose is not None:
+        return _verbose
+    # first time
+    try:
+        from os import getenv
+        _verbose = int(getenv('SALOME_VERBOSE'))
+    except:
+        _verbose = 0
+        pass
+    #
+    return _verbose
+
+def setVerbose(level):
+    global _verbose
+    _verbose = level
+    return
+
 # -----------------------------------------------------------------------------
 
 ###
@@ -150,7 +174,7 @@ section_to_skip = ""
 
 class xml_parser:
     def __init__(self, fileName, _opts ):
-        print "Configure parser: processing %s ..." % fileName
+        if verbose(): print "Configure parser: processing %s ..." % fileName
         self.space = []
         self.opts = _opts
         self.section = section_to_skip
@@ -314,6 +338,11 @@ def get_env():
 
     dirs.reverse() # reverse order, like in "path" variable - FILO-style processing
 
+    try:
+        dirs.remove('') # to remove empty dirs if the variable terminate by ":" or if there are "::" inside
+    except:
+        pass
+    
     _opts = {} # associative array of options to be filled
 
     # parse SalomeApp.xml files in directories specified by SalomeAppConfig env variable
index 0a0455954970f84263369ffe561782d48af9decc..16dbf097d9211d0054162e34bb5df161169a8c49 100755 (executable)
@@ -21,6 +21,7 @@
 
 import sys, os, string, glob, time, pickle
 import orbmodule
+from launchConfigureParser import verbose
 
 process_id = {}
 
@@ -236,11 +237,11 @@ def set_env(args, modules_list, modules_root_dir):
                    salome_subdir,"resources","kernel")
 
     if "GEOM" in modules_list:
-        print "GEOM OCAF Resources"
+        if verbose(): print "GEOM OCAF Resources"
         os.environ["CSF_GEOMDS_ResourcesDefaults"] \
         = os.path.join(modules_root_dir["GEOM"],"share",
                        salome_subdir,"resources","geom")
-       print "GEOM Shape Healing Resources"
+        if verbose(): print "GEOM Shape Healing Resources"
         os.environ["CSF_ShHealingDefaults"] \
         = os.path.join(modules_root_dir["GEOM"],"share",
                        salome_subdir,"resources","geom")
@@ -320,7 +321,7 @@ class Server:
                                  + os.getenv("LD_LIBRARY_PATH")]
             myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path
         command = myargs + self.CMD
-        print "command = ", command
+        if verbose(): print "command = ", command
         pid = os.spawnvp(os.P_NOWAIT, command[0], command)
         process_id[pid]=self.CMD
         self.PID = pid
@@ -604,7 +605,7 @@ def startSalome(args, modules_list, modules_root_dir):
     """Launch all SALOME servers requested by args"""
     init_time = os.times()
 
-    print "startSalome ", args
+    if verbose(): print "startSalome ", args
     
     #
     # Initialisation ORB et Naming Service
@@ -624,7 +625,7 @@ def startSalome(args, modules_list, modules_root_dir):
     # Notify Server launch
     #
 
-    print "Notify Server to launch"
+    if verbose(): print "Notify Server to launch"
 
     myServer=NotifyServer(args,modules_root_dir)
     myServer.run()
@@ -740,7 +741,7 @@ def startSalome(args, modules_list, modules_root_dir):
         session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session)
 
     end_time = os.times()
-    print
+    if verbose(): print
     print "Start SALOME, elapsed time : %5.1f seconds"% (end_time[4]
                                                          - init_time[4])
 
@@ -810,7 +811,7 @@ def useSalome(args, modules_list, modules_root_dir):
     pickle.dump(process_ids,fpid)
     fpid.close()
     
-    print """
+    if verbose(): print """
     Saving of the dictionary of Salome processes in %s
     To kill SALOME processes from a console (kill all sessions from all ports):
       python killSalome.py 
@@ -829,10 +830,12 @@ def useSalome(args, modules_list, modules_root_dir):
     #
     
     if clt != None:
-        print
-        print " --- registered objects tree in Naming Service ---"
-        clt.showNS()
-
+        if verbose():
+            print
+            print " --- registered objects tree in Naming Service ---"
+            clt.showNS()
+            pass
+        
         # run python scripts, passed via -t option
         toimport = args['pyscript']
         i = 0
index 026b9b7da71733d4f259fbec6a5dd2d68b4c7b7f..362f077e4bab01dc3e7ca28c5668fa5a64d42e29 100644 (file)
@@ -43,6 +43,7 @@ from SALOME_ComponentPy import *
 
 from SALOME_utilities import *
 from Utils_Identity import getShortHostName
+from launchConfigureParser import verbose
 
 #=============================================================================
 
@@ -61,7 +62,7 @@ class SALOME_Container_i:
         self._orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
         self._poa = self._orb.resolve_initial_references("RootPOA")
         self._containerName = containerName
-        print "SALOME_Container.SALOME_Container_i : _containerName ",self._containerName
+        if verbose(): print "SALOME_Container.SALOME_Container_i : _containerName ",self._containerName
         #self._naming_service = SALOME_NamingServicePy_i(self._orb)
         self._container = self._orb.string_to_object(containerIORStr)
 
index 6eb0110bc471762dc0282d4da2be41711739f845..7a96abcc59281a1fde518e9fba23ecd721f23f26 100755 (executable)
@@ -40,6 +40,7 @@ from SALOME_ComponentPy import *
 
 from SALOME_utilities import *
 from Utils_Identity import getShortHostName
+from launchConfigureParser import verbose
 
 #=============================================================================
 
@@ -61,7 +62,7 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
         Container_path = "/Containers/" + myMachine + "/" + containerName
         #self._containerName = containerName
         self._containerName = Container_path
-        print "container name ",self._containerName
+        if verbose(): print "container name ",self._containerName
 
         naming_service = SALOME_NamingServicePy_i(self._orb)
         self._naming_service = naming_service
index a7768ec2adec35536ae5fc64ed61fbd10b4fcdb0..d84b9da802c4f1e9ad91b9c7c3ac79b9424c4dcf 100644 (file)
@@ -380,7 +380,7 @@ CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path)
       CosNaming::Name n = ex.rest_of_name;
 
       if (ex.why == CosNaming::NamingContext::missing_node)
-        INFOS("Resolve() : " << (char *) n[0].id
+        MESSAGE("Resolve() : " << (char *) n[0].id
               << " (" << (char *) n[0].kind << ") not found");
 
       if (ex.why == CosNaming::NamingContext::not_context)
index dab74d492211ab21c14d6ce94cfc1250621cad64..0c8b3d6968f00f51b51800b28c25bf677944da61 100644 (file)
 #error INFOS_COMPILATION already defined
 #endif
 
-#define INFOS_COMPILATION { MESS_BEGIN("COMPILED with ") << COMPILER \
-                                      << ", " << __DATE__ \
-                                      << " at " << __TIME__ << MESS_END }
 #ifdef _DEBUG_
 
 // --- the following MACROS are useful at debug time
 
+#define INFOS_COMPILATION { MESS_BEGIN("COMPILED with ") << COMPILER \
+                                      << ", " << __DATE__ \
+                                      << " at " << __TIME__ << MESS_END }
+
 #define MESSAGE(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
 #define SCRUTE(var)  {MESS_BEGIN("- Trace ") << #var << "=" << var <<MESS_END}
 
 
 #else /* ifdef _DEBUG_*/
 
+#define INFOS_COMPILATION
 #define MESSAGE(msg) {}
 #define SCRUTE(var) {}
 #define REPERE
index 298b29f8746f3ceceadf111b27f723ab64206721..1d790ed9d030f4cad867ff058574d1ec81bb23b5 100644 (file)
 import SALOME_Trace
 GLogger = SALOME_Trace.SALOME_Trace()
 
+from launchConfigureParser import verbose
+
 def MYTRACE ():
-    if __debug__:
+    if verbose():
         str = "- Trace "
         GLogger.putMessage(str + "  : ")
         
 
 def REPERE():
-    if __debug__:
+    if verbose():
         GLogger.putMessage("   --------------  \n")
 
 
 def BEGIN_OF(msg):
-    if __debug__:
+    if verbose():
         REPERE(); MYTRACE();
         GLogger.putMessage("Begin of : "+ str(msg) + "\n")
         REPERE();
 
 
 def END_OF(msg):
-    if __debug__:
+    if verbose():
         REPERE(); MYTRACE();
         GLogger.putMessage("Normale end of : "+ str(msg) + "\n")
         REPERE();
 
 def MESSAGE(msg):
-    if __debug__:
+    if verbose():
         MYTRACE()
         GLogger.putMessage(str(msg) + "\n")