From 7db301ad4558eaa7f130d9f5a899155f17d46a06 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 13 Aug 2019 21:42:44 +0300 Subject: Add default options files search tracing --- bdep/bdep.cxx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/bdep/bdep.cxx b/bdep/bdep.cxx index d737d67..66431e9 100644 --- a/bdep/bdep.cxx +++ b/bdep/bdep.cxx @@ -153,6 +153,8 @@ init (const common_options& co, bool keep_sep, bool tmp) { + tracer trace ("init"); + O o; static_cast (o) = co; @@ -198,6 +200,18 @@ init (const common_options& co, scan_argument (args, scan); } + // Note that the diagnostics verbosity level can only be calculated after + // default options are loaded and merged (see below). Thus, to trace the + // default options files search, we refer to the verbosity level specified + // on the command line. + // + auto verbosity = [&o] () + { + return o.verbose_specified () + ? o.verbose () + : o.V () ? 3 : o.v () ? 2 : o.quiet () ? 0 : 1; + }; + // Handle default option files. // // Note: don't need to use group_scaner (no arguments in options files). @@ -208,7 +222,12 @@ init (const common_options& co, load_default_options ( nullopt /* sys_dir */, path::home_directory (), - options_files (cmd, o, args)), + options_files (cmd, o, args), + [&trace, &verbosity] (const path& f, bool remote) + { + if (verbosity () >= 3) + trace << "loading " << (remote ? "remote " : "local ") << f; + }), o); } catch (const system_error& e) @@ -221,9 +240,7 @@ init (const common_options& co, // Diagnostics verbosity. // - verb = o.verbose_specified () - ? o.verbose () - : o.V () ? 3 : o.v () ? 2 : o.quiet () ? 0 : 1; + verb = verbosity (); // Temporary directory. // -- cgit v1.1