[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 8 08:14:49 PST 2018
ilya-biryukov added inline comments.
================
Comment at: clangd/Logger.cpp:19
Logger *L = nullptr;
+bool Verbose_ = false;
} // namespace
----------------
Could we move the flag to implementation of `Logger`?
I.e.:
```
class Logger {
virtual log(const llvm::Twine &Message, bool Verbose);
};
// Implementation of top-level log
void clangd::log(const llvm::Twine &Message) {
L->log(Message, /*Verbose=*/false);
// should also handle missing Logger by logging into llvm::errs()
}
// Implementation of top-level vlog.
void clangd::vlog(const llvm::Twine &Message) {
L->log(Message, /*Verbose=*/true);
// should also handle missing Logger by logging into llvm::errs()
}
```
An implementation of the interface would decide whether to log or not, based on command-line argument.
================
Comment at: clangd/tool/ClangdMain.cpp:79
+static llvm::cl::opt<bool> Verbose("verbose", llvm::cl::desc("Be more verbose"),
+ llvm::cl::init(false));
----------------
Maybe just call it `-v`?
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D44226
More information about the cfe-commits
mailing list