diff options
| author | Charles Brunet <charles.brunet@optelgroup.com> | 2023-07-21 09:06:29 -0400 |
|---|---|---|
| committer | Xavier Claessens <xclaesse@gmail.com> | 2023-07-21 09:31:21 -0400 |
| commit | a84a082b1a1966cb448bc9bbe9cabfa4d967a657 (patch) | |
| tree | 55f4daa03eec529d4c241fdc978c71e0971a2811 | |
| parent | 047c2d644cdb006d01ce35f2fef76247ccb15335 (diff) | |
| download | meson-a84a082b1a1966cb448bc9bbe9cabfa4d967a657.tar.gz | |
Prevent summary displaying timestamp twice
Before:
[117.000] Subprojects
[117.000] OptelMessagingApi : [117.000] YES
[117.000] Python27 : [117.000] YES
[117.000] op300rtos : [117.000] YES
[117.000] optel-common-protos: [117.000] YES
After:
[38.938] Subprojects
[38.938] OptelMessagingApi : YES
[38.938] Python27 : YES
[38.938] op300rtos : YES
[38.938] optel-common-protos: YES
| -rw-r--r-- | mesonbuild/interpreter/interpreter.py | 4 | ||||
| -rw-r--r-- | mesonbuild/mlog.py | 25 |
2 files changed, 15 insertions, 14 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 235f04875..6aa0a3751 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -204,7 +204,7 @@ class Summary: def dump_value(self, arr, list_sep, indent): lines_sep = '\n' + ' ' * indent if list_sep is None: - mlog.log(*arr, sep=lines_sep) + mlog.log(*arr, sep=lines_sep, display_timestamp=False) return max_len = shutil.get_terminal_size().columns line = [] @@ -218,7 +218,7 @@ class Summary: line = [] line.append(v) line_len += v_len - mlog.log(*line, sep=list_sep) + mlog.log(*line, sep=list_sep, display_timestamp=False) known_library_kwargs = ( build.known_shlib_kwargs | diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py index b4314280d..e51399b4f 100644 --- a/mesonbuild/mlog.py +++ b/mesonbuild/mlog.py @@ -200,9 +200,9 @@ class _Logger: self.log_file = open(os.path.join(logdir, self._LOG_FNAME), 'w', encoding='utf-8') self.log_fatal_warnings = fatal_warnings - def process_markup(self, args: T.Sequence[TV_Loggable], keep: bool) -> T.List[str]: + def process_markup(self, args: T.Sequence[TV_Loggable], keep: bool, display_timestamp: bool = True) -> T.List[str]: arr = [] # type: T.List[str] - if self.log_timestamp_start is not None: + if self.log_timestamp_start is not None and display_timestamp: arr = ['[{:.3f}]'.format(time.monotonic() - self.log_timestamp_start)] for arg in args: if arg is None: @@ -240,21 +240,21 @@ class _Logger: print(cleaned, end='') def debug(self, *args: TV_Loggable, sep: T.Optional[str] = None, - end: T.Optional[str] = None) -> None: - arr = process_markup(args, False) + end: T.Optional[str] = None, display_timestamp: bool = True) -> None: + arr = process_markup(args, False, display_timestamp) if self.log_file is not None: print(*arr, file=self.log_file, sep=sep, end=end) self.log_file.flush() def _log(self, *args: TV_Loggable, is_error: bool = False, nested: bool = True, sep: T.Optional[str] = None, - end: T.Optional[str] = None) -> None: - arr = process_markup(args, False) + end: T.Optional[str] = None, display_timestamp: bool = True) -> None: + arr = process_markup(args, False, display_timestamp) if self.log_file is not None: print(*arr, file=self.log_file, sep=sep, end=end) self.log_file.flush() if colorize_console(): - arr = process_markup(args, True) + arr = process_markup(args, True, display_timestamp) if not self.log_errors_only or is_error: force_print(*arr, nested=nested, sep=sep, end=end) @@ -270,11 +270,12 @@ class _Logger: def log(self, *args: TV_Loggable, is_error: bool = False, once: bool = False, nested: bool = True, sep: T.Optional[str] = None, - end: T.Optional[str] = None) -> None: + end: T.Optional[str] = None, + display_timestamp: bool = True) -> None: if once: - self._log_once(*args, is_error=is_error, nested=nested, sep=sep, end=end) + self._log_once(*args, is_error=is_error, nested=nested, sep=sep, end=end, display_timestamp=display_timestamp) else: - self._log(*args, is_error=is_error, nested=nested, sep=sep, end=end) + self._log(*args, is_error=is_error, nested=nested, sep=sep, end=end, display_timestamp=display_timestamp) def log_timestamp(self, *args: TV_Loggable) -> None: if self.log_timestamp_start: @@ -282,7 +283,7 @@ class _Logger: def _log_once(self, *args: TV_Loggable, is_error: bool = False, nested: bool = True, sep: T.Optional[str] = None, - end: T.Optional[str] = None) -> None: + end: T.Optional[str] = None, display_timestamp: bool = True) -> None: """Log variant that only prints a given message one time per meson invocation. This considers ansi decorated values by the values they wrap without @@ -298,7 +299,7 @@ class _Logger: if t in self.logged_once: return self.logged_once.add(t) - self._log(*args, is_error=is_error, nested=nested, sep=sep, end=end) + self._log(*args, is_error=is_error, nested=nested, sep=sep, end=end, display_timestamp=display_timestamp) def _log_error(self, severity: _Severity, *rargs: TV_Loggable, once: bool = False, fatal: bool = True, |
