mirror of
https://github.com/MaskRay/ccls.git
synced 2024-12-02 12:27:07 +00:00
Log {Request,Notification}Message, and timestamp change due to dependency
This commit is contained in:
parent
b5b7e9b7e2
commit
823aea0207
@ -37,7 +37,8 @@ namespace {
|
|||||||
OptionCategory C("ccls options");
|
OptionCategory C("ccls options");
|
||||||
|
|
||||||
opt<bool> opt_help("h", desc("Alias for -help"), cat(C));
|
opt<bool> opt_help("h", desc("Alias for -help"), cat(C));
|
||||||
opt<int> opt_verbose("v", desc("verbosity"), init(0), cat(C));
|
opt<int> opt_verbose("v", desc("verbosity, from -3 (fatal) to 2 (verbose)"),
|
||||||
|
init(0), cat(C));
|
||||||
opt<std::string> opt_test_index("test-index", ValueOptional, init("!"),
|
opt<std::string> opt_test_index("test-index", ValueOptional, init("!"),
|
||||||
desc("run index tests"), cat(C));
|
desc("run index tests"), cat(C));
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ bool CacheInvalid(VFS *vfs, IndexFile *prev, const std::string &path,
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(vfs->mutex);
|
std::lock_guard<std::mutex> lock(vfs->mutex);
|
||||||
if (prev->mtime < vfs->state[path].timestamp) {
|
if (prev->mtime < vfs->state[path].timestamp) {
|
||||||
LOG_S(INFO) << "timestamp changed for " << path
|
LOG_V(1) << "timestamp changed for " << path
|
||||||
<< (from ? " (via " + *from + ")" : std::string());
|
<< (from ? " (via " + *from + ")" : std::string());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ bool CacheInvalid(VFS *vfs, IndexFile *prev, const std::string &path,
|
|||||||
if (strcmp(prev->args[i], args[i]) && sys::path::stem(args[i]) != stem)
|
if (strcmp(prev->args[i], args[i]) && sys::path::stem(args[i]) != stem)
|
||||||
changed = true;
|
changed = true;
|
||||||
if (changed)
|
if (changed)
|
||||||
LOG_S(INFO) << "args changed for " << path
|
LOG_V(1) << "args changed for " << path
|
||||||
<< (from ? " (via " + *from + ")" : std::string());
|
<< (from ? " (via " + *from + ")" : std::string());
|
||||||
return changed;
|
return changed;
|
||||||
};
|
};
|
||||||
@ -250,10 +250,14 @@ bool Indexer_Parse(SemaManager *completion, WorkingFiles *wfiles,
|
|||||||
if (auto mtime1 = LastWriteTime(dep.first.val().str())) {
|
if (auto mtime1 = LastWriteTime(dep.first.val().str())) {
|
||||||
if (dep.second < *mtime1) {
|
if (dep.second < *mtime1) {
|
||||||
reparse = 2;
|
reparse = 2;
|
||||||
|
LOG_V(1) << "timestamp changed for " << path_to_index << " via "
|
||||||
|
<< dep.first.val().str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reparse = 2;
|
reparse = 2;
|
||||||
|
LOG_V(1) << "timestamp changed for " << path_to_index << " via "
|
||||||
|
<< dep.first.val().str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -513,6 +517,10 @@ void LaunchStdin() {
|
|||||||
std::string method;
|
std::string method;
|
||||||
ReflectMember(reader, "id", id);
|
ReflectMember(reader, "id", id);
|
||||||
ReflectMember(reader, "method", method);
|
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())
|
if (method.empty())
|
||||||
continue;
|
continue;
|
||||||
bool should_exit = method == "exit";
|
bool should_exit = method == "exit";
|
||||||
@ -726,6 +734,7 @@ void NotifyOrRequest(const char *method, bool request,
|
|||||||
JsonWriter writer(&w);
|
JsonWriter writer(&w);
|
||||||
fn(writer);
|
fn(writer);
|
||||||
w.EndObject();
|
w.EndObject();
|
||||||
|
LOG_V(2) << (request ? "RequestMessage: " : "NotificationMessage: ") << method;
|
||||||
for_stdout->PushBack(output.GetString());
|
for_stdout->PushBack(output.GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,6 +762,8 @@ static void Reply(RequestId id, const char *key,
|
|||||||
JsonWriter writer(&w);
|
JsonWriter writer(&w);
|
||||||
fn(writer);
|
fn(writer);
|
||||||
w.EndObject();
|
w.EndObject();
|
||||||
|
if (id.Valid())
|
||||||
|
LOG_V(2) << "respond to RequestMessage: " << id.value;
|
||||||
for_stdout->PushBack(output.GetString());
|
for_stdout->PushBack(output.GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user