From 1201537c5ca6555ff8eb69438371c98b26384727 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Fri, 20 May 2016 16:09:47 +0200 Subject: [PATCH] Add the all_in_terminal global option in order to put all the traces in the terminal (for example compilation traces) --- salomeTools.py | 5 ++++- src/logger.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/salomeTools.py b/salomeTools.py index c2f1f6e..1c70d94 100755 --- a/salomeTools.py +++ b/salomeTools.py @@ -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 diff --git a/src/logger.py b/src/logger.py index 6b4d8fe..834d6f0 100644 --- a/src/logger.py +++ b/src/logger.py @@ -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 -- 2.39.2