clang-tools  7.0.0
Public Member Functions | Public Attributes | List of all members
clang::clangd::JSONOutput Class Reference

Encapsulates output and logs streams and provides thread-safe access to them. More...

#include <JSONRPCDispatcher.h>

Inheritance diagram for clang::clangd::JSONOutput:
[legend]
Collaboration diagram for clang::clangd::JSONOutput:
[legend]

Public Member Functions

 JSONOutput (llvm::raw_ostream &Outs, llvm::raw_ostream &Logs, Logger::Level MinLevel, llvm::raw_ostream *InputMirror=nullptr, bool Pretty=false)
 
void writeMessage (const llvm::json::Value &Result)
 Emit a JSONRPC message. More...
 
void log (Level, const llvm::formatv_object_base &Message) override
 Write a line to the logging stream. More...
 
void mirrorInput (const Twine &Message)
 Mirror Message into InputMirror stream. More...
 
- Public Member Functions inherited from clang::clangd::Logger
virtual ~Logger ()=default
 

Public Attributes

const bool Pretty
 

Additional Inherited Members

- Public Types inherited from clang::clangd::Logger
enum  Level { Debug, Verbose, Info, Error }
 
- Static Public Member Functions inherited from clang::clangd::Logger
static char indicator (Level L)
 

Detailed Description

Encapsulates output and logs streams and provides thread-safe access to them.

Definition at line 28 of file JSONRPCDispatcher.h.

Constructor & Destructor Documentation

◆ JSONOutput()

clang::clangd::JSONOutput::JSONOutput ( llvm::raw_ostream &  Outs,
llvm::raw_ostream &  Logs,
Logger::Level  MinLevel,
llvm::raw_ostream *  InputMirror = nullptr,
bool  Pretty = false 
)
inline

Member Function Documentation

◆ log()

void JSONOutput::log ( Logger::Level  Level,
const llvm::formatv_object_base &  Message 
)
overridevirtual

Write a line to the logging stream.

Implements clang::clangd::Logger.

Definition at line 75 of file JSONRPCDispatcher.cpp.

References clang::clangd::detail::log().

Referenced by JSONOutput().

◆ mirrorInput()

void JSONOutput::mirrorInput ( const Twine &  Message)

Mirror Message into InputMirror stream.

Does nothing if InputMirror is null. Unlike other methods of JSONOutput, mirrorInput is not thread-safe.

Definition at line 87 of file JSONRPCDispatcher.cpp.

References clang::clangd::elog(), clang::clangd::detail::log(), clang::tidy::modernize::Message, and clang::clangd::reply().

Referenced by JSONOutput().

◆ writeMessage()

void JSONOutput::writeMessage ( const llvm::json::Value &  Result)

Emit a JSONRPC message.

Definition at line 58 of file JSONRPCDispatcher.cpp.

References clang::tidy::modernize::Message, and clang::clangd::vlog().

Referenced by JSONOutput(), and clang::clangd::ClangdLSPServer::run().

Member Data Documentation

◆ Pretty

const bool clang::clangd::JSONOutput::Pretty

Definition at line 50 of file JSONRPCDispatcher.h.


The documentation for this class was generated from the following files: