public class TracingMessageConsumer extends java.lang.Object implements MessageConsumer
MessageConsumer that outputs logs in a format that can be parsed by the LSP Inspector.
https://microsoft.github.io/language-server-protocol/inspector/| Modifier and Type | Class and Description |
|---|---|
static class |
TracingMessageConsumer.RequestMetadata
Data class for holding pending request metadata.
|
| Constructor and 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) |
| Modifier and Type | Method and Description |
|---|---|
void |
consume(Message message)
Constructs a log string for a given
Message. |
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)
messageConsumer - The MessageConsumer to 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.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)
messageConsumer - The MessageConsumer to 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, or null to use default locale.public void consume(Message message) throws MessageIssueException, JsonRpcException
Message. The type of the MessageConsumer
determines if we're sending or receiving a message. The type of the @{link Message} determines
if it is a request, response, or notification.consume in interface MessageConsumerMessageIssueException - when an issue is found that prevents further processing of the messageJsonRpcException - when accessing the JSON-RPC communication channel fails