simark marked an inline comment as done. simark added inline comments.
================ Comment at: clangd/Logger.cpp:19 Logger *L = nullptr; +bool Verbose_ = false; } // namespace ---------------- ilya-biryukov wrote: > 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. That's what I thought of doing first. The issue is that if we don't set a logger with LoggingSession, the log function prints to stderr itself. So if we don't check the Verbose flag there, the -v flag will have no effect when LoggingSession has not been called (I don't know if it's really a problem or not, since in practice we call it). Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44226 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits