Package org.eclipse.lsp4j.jsonrpc
Class TracingMessageConsumer
- java.lang.Object
-
- org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer
-
- All Implemented Interfaces:
MessageConsumer
public class TracingMessageConsumer extends java.lang.Object implements MessageConsumer
AMessageConsumerthat outputs logs in a format that can be parsed by the LSP Inspector. https://microsoft.github.io/language-server-protocol/inspector/
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTracingMessageConsumer.RequestMetadataData class for holding pending request metadata.
-
Constructor Summary
Constructors Constructor Description TracingMessageConsumer(MessageConsumer messageConsumer, java.util.Map<java.lang.String,TracingMessageConsumer.RequestMetadata> sentRequests, java.util.Map<java.lang.String,TracingMessageConsumer.RequestMetadata> receivedRequests, java.io.PrintWriter printWriter, java.time.Clock clock)TracingMessageConsumer(MessageConsumer messageConsumer, java.util.Map<java.lang.String,TracingMessageConsumer.RequestMetadata> sentRequests, java.util.Map<java.lang.String,TracingMessageConsumer.RequestMetadata> receivedRequests, java.io.PrintWriter printWriter, java.time.Clock clock, java.util.Locale locale)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsume(Message message)Constructs a log string for a givenMessage.voidsetJsonHandler(MessageJsonHandler jsonHandler)
-
-
-
Constructor Detail
-
TracingMessageConsumer
public TracingMessageConsumer(MessageConsumer messageConsumer, java.util.Map<java.lang.String,TracingMessageConsumer.RequestMetadata> sentRequests, java.util.Map<java.lang.String,TracingMessageConsumer.RequestMetadata> receivedRequests, java.io.PrintWriter printWriter, java.time.Clock clock)
- Parameters:
messageConsumer- TheMessageConsumerto wrap.sentRequests- A map that keeps track of pending sent request data.receivedRequests- A map that keeps track of pending received request data.printWriter- Where to write the log to.clock- The clock that is used to calculate timestamps and durations.
-
TracingMessageConsumer
public TracingMessageConsumer(MessageConsumer messageConsumer, java.util.Map<java.lang.String,TracingMessageConsumer.RequestMetadata> sentRequests, java.util.Map<java.lang.String,TracingMessageConsumer.RequestMetadata> receivedRequests, java.io.PrintWriter printWriter, java.time.Clock clock, java.util.Locale locale)
- Parameters:
messageConsumer- TheMessageConsumerto wrap.sentRequests- A map that keeps track of pending sent request data.receivedRequests- A map that keeps track of pending received request data.printWriter- Where to write the log to.clock- The clock that is used to calculate timestamps and durations.locale- THe Locale to format the timestamps and durations, ornullto use default locale.
-
-
Method Detail
-
setJsonHandler
public void setJsonHandler(MessageJsonHandler jsonHandler)
-
consume
public void consume(Message message) throws MessageIssueException, JsonRpcException
Constructs a log string for a givenMessage. The type of theMessageConsumerdetermines if we're sending or receiving a message. The type of the @{link Message} determines if it is a request, response, or notification.- Specified by:
consumein interfaceMessageConsumer- Throws:
MessageIssueException- when an issue is found that prevents further processing of the messageJsonRpcException- when accessing the JSON-RPC communication channel fails
-
-