aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-08-13 21:42:44 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-08-14 15:06:04 +0300
commit7db301ad4558eaa7f130d9f5a899155f17d46a06 (patch)
tree963782186c627f1b77d170c6019d5b7f6a8cb0f5
parent307d809ef78ad507b031b3dc1573da0768dff7d1 (diff)
Add default options files search tracing
-rw-r--r--bdep/bdep.cxx25
1 files 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<common_options&> (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<O, cli::argv_file_scanner, cli::unknown_mode> (
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.
//