diff --git a/src/main.cc b/src/main.cc index 39c6457f..6bf11d68 100644 --- a/src/main.cc +++ b/src/main.cc @@ -49,7 +49,8 @@ namespace { OptionCategory C("ccls options"); opt opt_help("h", desc("Alias for -help"), cat(C)); -opt opt_verbose("v", desc("verbosity"), init(0), cat(C)); +opt opt_verbose("v", desc("verbosity, from -3 (fatal) to 2 (verbose)"), + init(0), cat(C)); opt opt_test_index("test-index", ValueOptional, init("!"), desc("run index tests"), cat(C)); diff --git a/src/pipeline.cc b/src/pipeline.cc index 650c44d2..f7337406 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -118,8 +118,8 @@ bool CacheInvalid(VFS *vfs, IndexFile *prev, const std::string &path, { std::lock_guard lock(vfs->mutex); if (prev->mtime < vfs->state[path].timestamp) { - LOG_S(INFO) << "timestamp changed for " << path - << (from ? " (via " + *from + ")" : std::string()); + LOG_V(1) << "timestamp changed for " << path + << (from ? " (via " + *from + ")" : std::string()); return true; } } @@ -131,8 +131,8 @@ bool CacheInvalid(VFS *vfs, IndexFile *prev, const std::string &path, if (strcmp(prev->args[i], args[i]) && sys::path::stem(args[i]) != stem) changed = true; if (changed) - LOG_S(INFO) << "args changed for " << path - << (from ? " (via " + *from + ")" : std::string()); + LOG_V(1) << "args changed for " << path + << (from ? " (via " + *from + ")" : std::string()); return changed; }; @@ -262,10 +262,14 @@ bool Indexer_Parse(SemaManager *completion, WorkingFiles *wfiles, if (auto mtime1 = LastWriteTime(dep.first.val().str())) { if (dep.second < *mtime1) { reparse = 2; + LOG_V(1) << "timestamp changed for " << path_to_index << " via " + << dep.first.val().str(); break; } } else { reparse = 2; + LOG_V(1) << "timestamp changed for " << path_to_index << " via " + << dep.first.val().str(); break; } } @@ -525,6 +529,10 @@ void LaunchStdin() { std::string method; ReflectMember(reader, "id", id); ReflectMember(reader, "method", method); + if (id.Valid()) + LOG_V(2) << "receive RequestMessage: " << id.value << " " << method; + else + LOG_V(2) << "receive NotificationMessage " << method; if (method.empty()) continue; bool should_exit = method == "exit"; @@ -738,6 +746,7 @@ void NotifyOrRequest(const char *method, bool request, JsonWriter writer(&w); fn(writer); w.EndObject(); + LOG_V(2) << (request ? "RequestMessage: " : "NotificationMessage: ") << method; for_stdout->PushBack(output.GetString()); } @@ -765,6 +774,8 @@ static void Reply(RequestId id, const char *key, JsonWriter writer(&w); fn(writer); w.EndObject(); + if (id.Valid()) + LOG_V(2) << "respond to RequestMessage: " << id.value; for_stdout->PushBack(output.GetString()); }