From 3c1ccb923fc110fa86893b3e7cbbfa0b75c9a4dc Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 22 Jul 2020 09:16:55 -0400 Subject: logs: Prepend current subproject name to all messages Meson used to prepend '|' for each nested subproject to distinguish in the logs where a subproject start and ends. It is more useful to print the current subproject name. Also print the call stack when starting a new subproject to better see which subproject chain leads to to. --- mesonbuild/interpreter.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'mesonbuild/interpreter.py') diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 5cf3dde..2e4444c 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2912,8 +2912,9 @@ external dependencies (including libraries) must go to "dependencies".''') self.global_args_frozen = True mlog.log() - with mlog.nested(): - mlog.log('Executing subproject', mlog.bold(subp_name), 'method', mlog.bold(method), '\n') + with mlog.nested(subp_name): + stack = ':'.join(self.subproject_stack + [subp_name]) + mlog.log('Executing subproject', mlog.bold(stack), 'method', mlog.bold(method), '\n') try: if method == 'meson': return self._do_subproject_meson(subp_name, subdir, default_options, kwargs) @@ -2926,7 +2927,7 @@ external dependencies (including libraries) must go to "dependencies".''') raise except Exception as e: if not required: - with mlog.nested(): + with mlog.nested(subp_name): # Suppress the 'ERROR:' prefix because this exception is not # fatal and VS CI treat any logs with "ERROR:" as fatal. mlog.exception(e, prefix=mlog.yellow('Exception:')) @@ -2938,7 +2939,7 @@ external dependencies (including libraries) must go to "dependencies".''') ast: T.Optional[mparser.CodeBlockNode] = None, build_def_files: T.Optional[T.List[str]] = None, is_translated: bool = False) -> SubprojectHolder: - with mlog.nested(): + with mlog.nested(subp_name): new_build = self.build.copy() subi = Interpreter(new_build, self.backend, subp_name, subdir, self.subproject_dir, self.modules, default_options, ast=ast, is_translated=is_translated) @@ -2975,7 +2976,7 @@ external dependencies (including libraries) must go to "dependencies".''') return self.subprojects[subp_name] def _do_subproject_cmake(self, subp_name, subdir, subdir_abs, default_options, kwargs): - with mlog.nested(): + with mlog.nested(subp_name): new_build = self.build.copy() prefix = self.coredata.options[OptionKey('prefix')].value @@ -2995,7 +2996,7 @@ external dependencies (including libraries) must go to "dependencies".''') ast = cm_int.pretend_to_be_meson(options.target_options) mlog.log() - with mlog.nested(): + with mlog.nested('cmake-ast'): mlog.log('Processing generated meson AST') # Debug print the generated meson file -- cgit v1.1 From 7c3418204f824a613c67e7ccd06ef6983656e904 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 10 Mar 2021 14:17:11 -0500 Subject: interpreter: Do not print "method meson" --- mesonbuild/interpreter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mesonbuild/interpreter.py') diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 2e4444c..8653b38 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2914,7 +2914,11 @@ external dependencies (including libraries) must go to "dependencies".''') mlog.log() with mlog.nested(subp_name): stack = ':'.join(self.subproject_stack + [subp_name]) - mlog.log('Executing subproject', mlog.bold(stack), 'method', mlog.bold(method), '\n') + m = ['Executing subproject', mlog.bold(stack)] + if method != 'meson': + m += ['method', mlog.bold(method)] + mlog.log(*m,'\n') + try: if method == 'meson': return self._do_subproject_meson(subp_name, subdir, default_options, kwargs) -- cgit v1.1 From 8cd4d0b2832666f19660b9006040e5ff7e5d4576 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 10 Mar 2021 14:19:48 -0500 Subject: mlog: Do not print 'subproject|' for the message 'Executing subproject' It already contains the full callstack and it's more visible when it's standing on its own line. --- mesonbuild/interpreter.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'mesonbuild/interpreter.py') diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 8653b38..4dcb48c 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2911,13 +2911,11 @@ external dependencies (including libraries) must go to "dependencies".''') os.makedirs(os.path.join(self.build.environment.get_build_dir(), subdir), exist_ok=True) self.global_args_frozen = True - mlog.log() - with mlog.nested(subp_name): - stack = ':'.join(self.subproject_stack + [subp_name]) - m = ['Executing subproject', mlog.bold(stack)] - if method != 'meson': - m += ['method', mlog.bold(method)] - mlog.log(*m,'\n') + stack = ':'.join(self.subproject_stack + [subp_name]) + m = ['\nExecuting subproject', mlog.bold(stack)] + if method != 'meson': + m += ['method', mlog.bold(method)] + mlog.log(*m,'\n', nested=False) try: if method == 'meson': -- cgit v1.1