Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import com.sun.jdi.BooleanValue;
import com.sun.jdi.Field;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.StringReference;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.ThreadReference;
import com.sun.jdi.Value;
Expand Down Expand Up @@ -222,6 +223,11 @@ public static boolean handleEvaluationResult(IDebugAdapterContext context, Threa
context.getProtocolServer().sendEvent(new Events.UserNotificationEvent(
Events.UserNotificationEvent.NotificationType.ERROR,
String.format("[Logpoint] Log message '%s' error: %s", breakpoint.getLogMessage(), ex.getMessage())));
} else if (value != null) {
if (value instanceof StringReference) {
String message = ((StringReference) value).value();
context.getProtocolServer().sendEvent(new Events.LogpointEvent(message));
Comment thread
sbj42 marked this conversation as resolved.
Outdated
}
}
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,19 @@ public UserNotificationEvent(NotificationType notifyType, String message) {
}
}

public static class LogpointEvent extends DebugEvent {

public String message;

/**
* Constructor.
*/
public LogpointEvent(String message) {
super("logpoint");
this.message = message;
}
}

public static enum InvalidatedAreas {
@SerializedName("all")
ALL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ private String logMessageToExpression(String logMessage) {
}

if (arguments.size() > 0) {
return "System.out.println(String.format(\"" + format + "\"," + String.join(",", arguments) + "))";
return "String.format(\"" + format + "\"," + String.join(",", arguments) + ")";
} else {
return "System.out.println(\"" + format + "\")";
return "\"" + format + "\"";
}
}

Expand Down