9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_LOGGER_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_LOGGER_H 12 #include "llvm/ADT/Twine.h" 13 #include "llvm/Support/Debug.h" 14 #include "llvm/Support/Error.h" 15 #include "llvm/Support/FormatAdapters.h" 16 #include "llvm/Support/FormatVariadic.h" 40 template <
typename T> T &&
wrap(T &&V) {
return std::forward<T>(V); }
41 inline decltype(fmt_consume(llvm::Error::success()))
wrap(
llvm::
Error &&V) {
42 return fmt_consume(std::move(V));
44 template <
typename... Ts>
56 template <
typename... Ts>
void elog(
const char *Fmt, Ts &&... Vals) {
62 template <
typename... Ts>
void log(
const char *Fmt, Ts &&... Vals) {
67 template <
typename... Ts>
void vlog(
const char *Fmt, Ts &&... Vals) {
73 DEBUG_WITH_TYPE(::clang::clangd::detail::debugType(__FILE__), \ 74 ::clang::clangd::detail::log(Logger::Debug, __VA_ARGS__)) 93 : MinLevel(MinLevel), Logs(Logs) {}
100 llvm::raw_ostream &Logs;
102 std::mutex StreamMutex;
Some operations such as code completion produce a set of candidates.
void log(Logger::Level, const llvm::formatv_object_base &)
constexpr llvm::StringLiteral Message
static char indicator(Level L)
decltype(fmt_consume(llvm::Error::success())) wrap(llvm::Error &&V)
void vlog(const char *Fmt, Ts &&... Vals)
void elog(const char *Fmt, Ts &&... Vals)
const char * debugType(const char *Filename)
virtual void log(Level, const llvm::formatv_object_base &Message)=0
Implementations of this method must be thread-safe.
std::string Filename
Filename as a string.
Interface to allow custom logging in clangd.
Only one LoggingSession can be active at a time.
virtual ~Logger()=default
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
StreamLogger(llvm::raw_ostream &Logs, Logger::Level MinLevel)