use spdlog for logging in the unittest

This commit is contained in:
Benjamin Sergeant 2019-05-13 17:32:57 -07:00
parent 89b9e6e531
commit 66dae5840c
2 changed files with 11 additions and 9 deletions

View File

@ -11,6 +11,7 @@
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <mutex> #include <mutex>
#include <spdlog/spdlog.h>
namespace ix namespace ix
{ {
@ -32,8 +33,9 @@ namespace ix
{ {
std::lock_guard<std::mutex> lock(_mutex); std::lock_guard<std::mutex> lock(_mutex);
std::cerr << obj; std::stringstream ss;
std::cerr << std::endl; ss << obj;
spdlog::info(ss.str());
return *this; return *this;
} }

View File

@ -62,33 +62,33 @@ namespace
std::stringstream ss; std::stringstream ss;
if (messageType == ix::WebSocketMessageType::Open) if (messageType == ix::WebSocketMessageType::Open)
{ {
log("cmd_websocket_satori_chat: connected !"); log("TestConnectionDisconnection: connected !");
} }
else if (messageType == ix::WebSocketMessageType::Close) else if (messageType == ix::WebSocketMessageType::Close)
{ {
log("cmd_websocket_satori_chat: disconnected !"); log("TestConnectionDisconnection: disconnected !");
} }
else if (messageType == ix::WebSocketMessageType::Error) else if (messageType == ix::WebSocketMessageType::Error)
{ {
ss << "cmd_websocket_satori_chat: Error! "; ss << "TestConnectionDisconnection: Error! ";
ss << error.reason; ss << error.reason;
log(ss.str()); log(ss.str());
} }
else if (messageType == ix::WebSocketMessageType::Message) else if (messageType == ix::WebSocketMessageType::Message)
{ {
log("cmd_websocket_satori_chat: received message.!"); log("TestConnectionDisconnection: received message.!");
} }
else if (messageType == ix::WebSocketMessageType::Ping) else if (messageType == ix::WebSocketMessageType::Ping)
{ {
log("cmd_websocket_satori_chat: received ping message.!"); log("TestConnectionDisconnection: received ping message.!");
} }
else if (messageType == ix::WebSocketMessageType::Pong) else if (messageType == ix::WebSocketMessageType::Pong)
{ {
log("cmd_websocket_satori_chat: received pong message.!"); log("TestConnectionDisconnection: received pong message.!");
} }
else if (messageType == ix::WebSocketMessageType::Fragment) else if (messageType == ix::WebSocketMessageType::Fragment)
{ {
log("cmd_websocket_satori_chat: received fragment.!"); log("TestConnectionDisconnection: received fragment.!");
} }
else else
{ {