99 * @since 10.05.2018
1010 */
1111@ Slf4j
12- public class WebSocketLogger {
12+ public final class WebSocketLogger {
13+
14+ private WebSocketLogger () { }
1315
1416 public static void connected (String chargeBoxId , WebSocketSession session ) {
1517 log .info ("[chargeBoxId={}, sessionId={}] Connection is established" , chargeBoxId , session .getId ());
@@ -19,6 +21,14 @@ public static void closed(String chargeBoxId, WebSocketSession session, CloseSta
1921 log .warn ("[chargeBoxId={}, sessionId={}] Connection is closed, status: {}" , chargeBoxId , session .getId (), closeStatus );
2022 }
2123
24+ public static void sending (String chargeBoxId , WebSocketSession session , String msg ) {
25+ log .info ("[chargeBoxId={}, sessionId={}] Sending: {}" , chargeBoxId , session .getId (), msg );
26+ }
27+
28+ public static void sendingPing (String chargeBoxId , WebSocketSession session ) {
29+ log .debug ("[chargeBoxId={}, sessionId={}] Sending ping message" , chargeBoxId , session .getId ());
30+ }
31+
2232 public static void receivedPong (String chargeBoxId , WebSocketSession session ) {
2333 log .debug ("[chargeBoxId={}, sessionId={}] Received pong message" , chargeBoxId , session .getId ());
2434 }
@@ -27,7 +37,15 @@ public static void receivedText(String chargeBoxId, WebSocketSession session, St
2737 log .info ("[chargeBoxId={}, sessionId={}] Received: {}" , chargeBoxId , session .getId (), msg );
2838 }
2939
30- public static void sending (String chargeBoxId , WebSocketSession session , String msg ) {
31- log .info ("[chargeBoxId={}, sessionId={}] Sending: {}" , chargeBoxId , session .getId (), msg );
40+ public static void pingError (String chargeBoxId , WebSocketSession session , Throwable t ) {
41+ if (log .isErrorEnabled ()) {
42+ log .error ("[chargeBoxId=" + chargeBoxId + ", sessionId=" + session .getId () + "] Ping error" , t );
43+ }
44+ }
45+
46+ public static void transportError (String chargeBoxId , WebSocketSession session , Throwable t ) {
47+ if (log .isErrorEnabled ()) {
48+ log .error ("[chargeBoxId=" + chargeBoxId + ", sessionId=" + session .getId () + "] Transport error" , t );
49+ }
3250 }
3351}
0 commit comments