Commit 3204a543 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Initialize the logger before using it

parent caaca10b
...@@ -1242,6 +1242,8 @@ def FixEnvVars(): ...@@ -1242,6 +1242,8 @@ def FixEnvVars():
'''Updates required environment variables''' '''Updates required environment variables'''
# DMT tarball is now obsolete - we will use the repos-provided # DMT tarball is now obsolete - we will use the repos-provided
# versions of the DMT tools # versions of the DMT tools
global g_currentStage
g_currentStage = "Initialization"
DMTpath = getSingleLineFromCmdOutput("taste-config --prefix") + os.sep + "share" DMTpath = getSingleLineFromCmdOutput("taste-config --prefix") + os.sep + "share"
os.putenv("DMT", DMTpath) os.putenv("DMT", DMTpath)
...@@ -1270,18 +1272,21 @@ def FixEnvVars(): ...@@ -1270,18 +1272,21 @@ def FixEnvVars():
os.putenv("GEODE_NBPAR_PROC", "0") os.putenv("GEODE_NBPAR_PROC", "0")
def ParseCommandLineArgs(): def setLogger():
'''Parses options passed in the command line''' ''' Initialize the logging function '''
global g_stageLog
disableColor = "--nocolor" in sys.argv disableColor = "--nocolor" in sys.argv
if disableColor: if disableColor:
sys.argv.remove("--nocolor") sys.argv.remove("--nocolor")
global g_stageLog
g_stageLog = logging.getLogger("tasteBuilder") g_stageLog = logging.getLogger("tasteBuilder")
console = logging.StreamHandler(sys.__stdout__) console = logging.StreamHandler(sys.__stdout__)
console.setFormatter(ColorFormatter(sys.stdin.isatty() and not disableColor)) console.setFormatter(ColorFormatter(sys.stdin.isatty() and not disableColor))
g_stageLog.setLevel(logging.INFO) g_stageLog.setLevel(logging.INFO)
g_stageLog.addHandler(console) g_stageLog.addHandler(console)
def ParseCommandLineArgs():
'''Parses options passed in the command line'''
g_stageLog.info("Parsing Command Line Args") g_stageLog.info("Parsing Command Line Args")
try: try:
args = sys.argv[1:] args = sys.argv[1:]
...@@ -2244,6 +2249,7 @@ def ApplyPatchForDeploymentViewNeededByOcarinaForNewEllidissTools(depl_aadlFile) ...@@ -2244,6 +2249,7 @@ def ApplyPatchForDeploymentViewNeededByOcarinaForNewEllidissTools(depl_aadlFile)
def main(): def main():
setLogger()
FixEnvVars() FixEnvVars()
cmdLineInformation = ParseCommandLineArgs() cmdLineInformation = ParseCommandLineArgs()
outputDir, i_aadlFile, depl_aadlFile, \ outputDir, i_aadlFile, depl_aadlFile, \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment