1
1
2
2
#include " WSListener.hpp"
3
+ #include " oatpp/base/Log.hpp"
3
4
4
5
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5
6
// WSListener
6
7
7
8
oatpp::async::CoroutineStarter WSListener::onPing (const std::shared_ptr<AsyncWebSocket>& socket, const oatpp::String& message) {
8
- OATPP_LOGD (TAG, " onPing" );
9
+ OATPP_LOGd (TAG, " onPing" );
9
10
return socket->sendPongAsync (message);
10
11
}
11
12
12
13
oatpp::async::CoroutineStarter WSListener::onPong (const std::shared_ptr<AsyncWebSocket>& socket, const oatpp::String& message) {
13
- OATPP_LOGD (TAG, " onPong" );
14
+ OATPP_LOGd (TAG, " onPong" );
14
15
return nullptr ; // do nothing
15
16
}
16
17
17
18
oatpp::async::CoroutineStarter WSListener::onClose (const std::shared_ptr<AsyncWebSocket>& socket, v_uint16 code, const oatpp::String& message) {
18
- OATPP_LOGD (TAG, " onClose code=%d " , code);
19
+ OATPP_LOGd (TAG, " onClose code={} " , code);
19
20
return nullptr ; // do nothing
20
21
}
21
22
@@ -26,7 +27,7 @@ oatpp::async::CoroutineStarter WSListener::readMessage(const std::shared_ptr<Asy
26
27
auto wholeMessage = m_messageBuffer.toString ();
27
28
m_messageBuffer.setCurrentPosition (0 );
28
29
29
- OATPP_LOGD (TAG, " onMessage message='%s '" , wholeMessage-> c_str ());
30
+ OATPP_LOGd (TAG, " onMessage message='{} '" , wholeMessage)
30
31
31
32
/* Send message in reply */
32
33
return socket->sendOneFrameTextAsync ( " Hello from oatpp!: " + wholeMessage);
@@ -47,7 +48,7 @@ std::atomic<v_int32> WSInstanceListener::SOCKETS(0);
47
48
void WSInstanceListener::onAfterCreate_NonBlocking (const std::shared_ptr<WSListener::AsyncWebSocket>& socket, const std::shared_ptr<const ParameterMap>& params) {
48
49
49
50
SOCKETS ++;
50
- OATPP_LOGD (TAG, " New Incoming Connection. Connection count=%d " , SOCKETS.load ());
51
+ OATPP_LOGd (TAG, " New Incoming Connection. Connection count={} " , SOCKETS.load ());
51
52
52
53
/* In this particular case we create one WSListener per each connection */
53
54
/* Which may be redundant in many cases */
@@ -57,6 +58,6 @@ void WSInstanceListener::onAfterCreate_NonBlocking(const std::shared_ptr<WSListe
57
58
void WSInstanceListener::onBeforeDestroy_NonBlocking (const std::shared_ptr<WSListener::AsyncWebSocket>& socket) {
58
59
59
60
SOCKETS --;
60
- OATPP_LOGD (TAG, " Connection closed. Connection count=%d " , SOCKETS.load ());
61
+ OATPP_LOGd (TAG, " Connection closed. Connection count={} " , SOCKETS.load ());
61
62
62
63
}
0 commit comments