Disable logging of filtered project paths, but let user enable it in config.

This commit is contained in:
Jacob Dufault 2017-05-21 23:45:47 -07:00
parent da6a8f335f
commit 8d9374ee59
2 changed files with 16 additions and 7 deletions

View File

@ -7,11 +7,15 @@
struct Config { struct Config {
// Root directory of the project. **Not serialized** // Root directory of the project. **Not serialized**
std::string projectRoot; std::string projectRoot;
std::string cacheDirectory; std::string cacheDirectory;
std::vector<std::string> extraClangArguments;
std::vector<std::string> indexWhitelist; std::vector<std::string> indexWhitelist;
std::vector<std::string> indexBlacklist; std::vector<std::string> indexBlacklist;
std::vector<std::string> extraClangArguments; // If true, project paths that were skipped by the whitelist/blacklist will
// be logged.
bool logSkippedPathsForIndex = false;
// Maximum workspace search results. // Maximum workspace search results.
int maxWorkspaceSearchResults = 1000; int maxWorkspaceSearchResults = 1000;
@ -54,9 +58,12 @@ struct Config {
}; };
MAKE_REFLECT_STRUCT(Config, MAKE_REFLECT_STRUCT(Config,
cacheDirectory, cacheDirectory,
indexWhitelist, indexBlacklist,
extraClangArguments, extraClangArguments,
indexWhitelist, indexBlacklist,
logSkippedPathsForIndex,
maxWorkspaceSearchResults, maxWorkspaceSearchResults,
indexerCount, indexerCount,
enableIndexing, enableCacheWrite, enableCacheRead, enableIndexing, enableCacheWrite, enableCacheRead,

View File

@ -395,11 +395,13 @@ void Project::ForAllFilteredFiles(Config* config, std::function<void(int i, cons
if (matcher.IsMatch(entry.filename, &failure_reason)) if (matcher.IsMatch(entry.filename, &failure_reason))
action(i, entries[i]); action(i, entries[i]);
else { else {
if (config->logSkippedPathsForIndex) {
std::stringstream output; std::stringstream output;
output << '[' << (i + 1) << '/' << entries.size() << "] Failed " << failure_reason << "; skipping " << entry.filename << std::endl; output << '[' << (i + 1) << '/' << entries.size() << "] Failed " << failure_reason << "; skipping " << entry.filename << std::endl;
std::cerr << output.str(); std::cerr << output.str();
} }
} }
}
} }
TEST_SUITE("Project"); TEST_SUITE("Project");