]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
Add the all_in_terminal global option in order to put all the traces in the terminal...
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Fri, 20 May 2016 14:09:47 +0000 (16:09 +0200)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Fri, 20 May 2016 14:09:47 +0000 (16:09 +0200)
salomeTools.py
src/logger.py

index c2f1f6e6d849c6d7286e675a52a7314c1af59498..1c70d943732c4b7695e4d5be11cad113c3a7b890 100755 (executable)
@@ -79,6 +79,8 @@ parser.add_option('v', 'verbose', 'int', "output_verbose_level",
                   _("change output verbose level (default is 3)."))
 parser.add_option('b', 'batch', 'boolean', "batch", 
                   _("batch mode (no question)."))
+parser.add_option('t', 'all_in_terminal', 'boolean', "all_in_terminal", 
+                  _("All traces in the terminal (for example compilation logs)."))
 
 class Sat(object):
     '''The main class that stores all the commands of salomeTools
@@ -186,7 +188,8 @@ class Sat(object):
                 # create log file, unless the command is called 
                 # with a logger as parameter
                 logger_command = src.logger.Logger(self.cfg, 
-                                                   silent_sysstd=silent)
+                                                   silent_sysstd=silent,
+                                                   all_in_terminal=options.all_in_terminal)
                 if logger:
                     logger_command = logger
                 
index 6b4d8fe5785317b3dc0ac902d79d63c709380ae0..834d6f0dce70e7a92e5ff09f2b8e0492867c90da 100644 (file)
@@ -32,7 +32,7 @@ logCommandFileExpression = "^[0-9]{8}_+[0-9]{6}_+.*\.xml$"
 class Logger(object):
     '''Class to handle log mechanism.
     '''
-    def __init__(self, config, silent_sysstd=False):
+    def __init__(self, config, silent_sysstd=False, all_in_terminal=False):
         '''Initialization
         
         :param config pyconf.Config: The global configuration.
@@ -65,6 +65,8 @@ class Logger(object):
         self.put_initial_xml_fields()
         # Initialize the txt file for reading
         self.logTxtFile = open(str(self.txtFilePath), 'w')
+        if all_in_terminal:
+            self.logTxtFile = sys.__stdout__
         
     def put_initial_xml_fields(self):
         '''Method called at class initialization : Put all fields