3#include <llvm/Support/Debug.h>
4#include <llvm/Support/Error.h>
5#include <llvm/Support/FormatAdapters.h>
6#include <llvm/Support/FormatVariadic.h>
24 const llvm::formatv_object_base &Message) = 0;
28const char *
debugType(
const char *Filename);
33template <
typename T> T &&
wrap(T &&V) {
return std::forward<T>(V); }
34inline decltype(fmt_consume(llvm::Error::success()))
wrap(llvm::Error &&V) {
35 return fmt_consume(std::move(V));
37template <
typename... Ts>
40 llvm::formatv(Fmt,
detail::wrap(std::forward<Ts>(Vals))...));
43llvm::Error
error(std::error_code, std::string &&);
52template <
typename... Ts>
void elog(
const char *Fmt, Ts &&...Vals) {
58template <
typename... Ts>
void log(
const char *Fmt, Ts &&...Vals) {
63template <
typename... Ts>
void vlog(
const char *Fmt, Ts &&...Vals) {
69template <
typename... Ts>
70llvm::Error
error(std::error_code EC,
const char *Fmt, Ts &&...Vals) {
73 EC, llvm::formatv(Fmt,
detail::wrap(std::forward<Ts>(Vals))...).str());
76template <
typename... Ts> llvm::Error
error(
const char *Fmt, Ts &&...Vals) {
78 llvm::inconvertibleErrorCode(),
79 llvm::formatv(Fmt,
detail::wrap(std::forward<Ts>(Vals))...).str());
82inline llvm::Error
error(std::error_code EC, std::string Msg) {
86inline llvm::Error
error(std::string Msg) {
87 return detail::error(llvm::inconvertibleErrorCode(), std::move(Msg));
112 const llvm::formatv_object_base &Message)
override;
116 llvm::raw_ostream &Logs;
Interface to allow custom logging in clangd.
virtual ~Logger()=default
static char indicator(Level L)
virtual void log(Level, const char *Fmt, const llvm::formatv_object_base &Message)=0
Implementations of this method must be thread-safe.
Only one LoggingSession can be active at a time.
LoggingSession & operator=(LoggingSession &&)=delete
LoggingSession(LoggingSession &&)=delete
LoggingSession(LoggingSession const &)=delete
LoggingSession & operator=(LoggingSession const &)=delete
LoggingSession(Logger &Instance)
void log(Level, const char *Fmt, const llvm::formatv_object_base &Message) override
Write a line to the logging stream.
StreamLogger(llvm::raw_ostream &Logs, Logger::Level MinLevel)
void logImpl(Logger::Level, const char *Fmt, const llvm::formatv_object_base &)
const char * debugType(const char *Filename)
void log(Logger::Level L, const char *Fmt, Ts &&...Vals)
llvm::Error error(std::error_code, std::string &&)
Whether current platform treats paths case insensitively.
llvm::Error error(std::error_code EC, const char *Fmt, Ts &&...Vals)
void elog(const char *Fmt, Ts &&...Vals)
void vlog(const char *Fmt, Ts &&...Vals)
void log(const char *Fmt, Ts &&...Vals)