From a06f730958ed930280756781a7f7df51dc94328d Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Thu, 14 Sep 2017 00:22:06 -0700 Subject: [PATCH] Better logging, add notes about a bug. --- src/command_line.cc | 19 +++++++++++++++++-- src/threaded_queue.h | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/command_line.cc b/src/command_line.cc index 9a958510..99a54b71 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -925,7 +925,7 @@ std::vector DoParseFile( assert(!dependency.empty()); if (file_needs_parse(dependency) == FileParseQuery::NeedsParse) { - LOG_S(INFO) << "Timestamp has changed for " << dependency; + LOG_S(INFO) << "Timestamp has changed for " << dependency << " (via " << previous_index->path << ")"; needs_reparse = true; // SUBTLE: Do not break here, as |file_consumer_shared| is updated // inside of |file_needs_parse|. @@ -945,13 +945,25 @@ std::vector DoParseFile( if (!file_consumer_shared->Mark(dependency)) continue; - LOG_S(INFO) << "Emitting index result for " << dependency; + LOG_S(INFO) << "Emitting index result for " << dependency << " (via " << previous_index->path << ")"; result.push_back(Index_DoIdMap(cache_loader->TryTakeOrLoad(dependency), perf, is_interactive, false /*write_to_disk*/)); } return result; } } + // TODO: fix indexing issue. + // - threaded_queue.h timestamp change from command_line.cc (force repase) + // - threaded_queue.h timestamp change from clang_complete.cc (force reparse) + // - threaded_queue.h cached index emitted from ipc_manager (load cache) + // + // RESULT: + // - we indexed command_line.cc and clang_complete.cc but did not update threaded_queue.h + // + // Ideas: + // - find the set of changes, try to commit/lock those changes, redo logic if failed. + + LOG_S(INFO) << "Parsing " << path; // Load file contents for all dependencies into memory. If the dependencies @@ -1101,6 +1113,7 @@ bool IndexMain_DoCreateIndexUpdate( // Write current index to disk if requested. if (response->write_to_disk) { + LOG_S(INFO) << "Writing cached index to disk for " << response->current->file->path; time.Reset(); WriteToCache(config, *response->current->file); response->perf.index_save_to_disk = time.ElapsedMicrosecondsAndReset(); @@ -3048,7 +3061,9 @@ void LanguageServerMain(const std::string& bin_name, Config* config, MultiQueueW int main(int argc, char** argv) { loguru::init(argc, argv); + loguru::add_file("cquery.log", loguru::Truncate, loguru::Verbosity_MAX); loguru::g_flush_interval_ms = 0; + // loguru::g_stderr_verbosity = 1; MultiQueueWaiter waiter; IpcManager::CreateInstance(&waiter); diff --git a/src/threaded_queue.h b/src/threaded_queue.h index 8df109f7..89022e63 100644 --- a/src/threaded_queue.h +++ b/src/threaded_queue.h @@ -9,6 +9,9 @@ #include #include +using std::experimental::optional; +using std::experimental::nullopt; + // TODO: cleanup includes. struct BaseThreadQueue {