blob: 7cf05561433e8bc291458c316079387ed114910c [file] [log] [blame]
Ilya Biryukove5128f72017-09-20 07:24:15 +00001//===--- Logger.h - Logger interface for clangd ------------------*- C++-*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_LOGGER_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_LOGGER_H
12
13#include "llvm/ADT/Twine.h"
14
15namespace clang {
16namespace clangd {
17
18/// Interface to allow custom logging in clangd.
19class Logger {
20public:
21 virtual ~Logger() = default;
22
23 /// Implementations of this method must be thread-safe.
24 virtual void log(const llvm::Twine &Message) = 0;
25};
26
27/// Logger implementation that ignores all messages.
28class EmptyLogger : public Logger {
29public:
30 static EmptyLogger &getInstance();
31
32 void log(const llvm::Twine &Message) override;
33
34private:
35 EmptyLogger() = default;
36};
37
38} // namespace clangd
39} // namespace clang
40
41#endif