Go to the documentation of this file.
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_LOGGER_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_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.
Interface to allow custom logging in clangd.
static const char Message[]
std::string Filename
Filename as a string.
const char * debugType(const char *Filename)
virtual ~Logger()=default
StreamLogger(llvm::raw_ostream &Logs, Logger::Level MinLevel)
void log(Level, const llvm::formatv_object_base &Message) override
Write a line to the logging stream.
LoggingSession & operator=(LoggingSession &&)=delete
Only one LoggingSession can be active at a time.
void vlog(const char *Fmt, Ts &&... Vals)
virtual void log(Level, const llvm::formatv_object_base &Message)=0
Implementations of this method must be thread-safe.
void log(const char *Fmt, Ts &&... Vals)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static char indicator(Level L)
LoggingSession(clangd::Logger &Instance)
void elog(const char *Fmt, Ts &&... Vals)
void log(Logger::Level, const llvm::formatv_object_base &)