Skip to content

Commit e00402e

Browse files
authored
Merge pull request ChargeTimeEU#153 from jmluy/message-tostring
Add toString to Message for clearer logs
2 parents fedca97 + a59633d commit e00402e

File tree

1 file changed

+11
-0
lines changed
  • ocpp-common/src/main/java/eu/chargetime/ocpp/model

1 file changed

+11
-0
lines changed

ocpp-common/src/main/java/eu/chargetime/ocpp/model/Message.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ of this software and associated documentation files (the "Software"), to deal
2727
SOFTWARE.
2828
*/
2929

30+
import eu.chargetime.ocpp.utilities.MoreObjects;
31+
3032
/** Wrapper class for a message */
3133
public class Message {
3234
private String id;
@@ -86,4 +88,13 @@ public String getAction() {
8688
public void setAction(String action) {
8789
this.action = action;
8890
}
91+
92+
@Override
93+
public String toString() {
94+
return MoreObjects.toStringHelper(this)
95+
.add("id", id)
96+
.add("payload", payload)
97+
.add("action", action)
98+
.toString();
99+
}
89100
}

0 commit comments

Comments
 (0)