From: vsr Date: Thu, 7 Apr 2011 05:44:53 +0000 (+0000) Subject: Move verbose() / setVerbose() functions to the salome_utils X-Git-Tag: V6_3_0a1~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f3c456009f3d0a3bf1836385b79eecf757229ecc;p=modules%2Fkernel.git Move verbose() / setVerbose() functions to the salome_utils --- diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index fc3f11e32..7cfd8fc6d 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -26,6 +26,8 @@ import xml.sax import optparse import types +from salome_utils import verbose, setVerbose, getPortNumber + # names of tags in XML configuration file doc_tag = "document" sec_tag = "section" @@ -168,30 +170,6 @@ def userFile(appname): # -- -_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 - -# -- - def process_containers_params( standalone, embedded ): # 1. filter inappropriate containers names if standalone is not None: @@ -903,7 +881,6 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): args[appname_nam] = appname # get the port number - from salome_utils import getPortNumber my_port = getPortNumber() args[port_nam] = my_port diff --git a/bin/salome_utils.py b/bin/salome_utils.py index 7195585e2..75e625b12 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -428,3 +428,37 @@ def uniteFiles( src_file, dest_file ): pass os.system( command ) + +# -- + +_verbose = None + +def verbose(): + """ + Get verbosity level. Default verbosity level is specified via the environment variable + SALOME_VERBOSE, e.g.: + [bash %] export SALOME_VERBOSE=1 + The function setVerbose() can be used to change verbosity level explicitly. + """ + 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): + """ + Change verbosity level. The function verbose() can be used to get current verbosity level. + """ + global _verbose + _verbose = level + return +