server:日志打印等级。
This commit is contained in:
parent
43aedf6f08
commit
abca5ffa4f
@ -104,11 +104,11 @@ void RelayServer::thClientThread(const std::shared_ptr<wxSocketBase>& wxSock, co
|
||||
wxSock->Read(client->buf.data(), GBUFFER_SIZE);
|
||||
auto br = wxSock->LastCount();
|
||||
if (br == 0) {
|
||||
wxLogMessage(wxT("Client disconnected: %s"), id);
|
||||
wxLogMessage(wxT("client disconnected: %s"), id);
|
||||
ClearClient(id);
|
||||
break;
|
||||
} else if (wxSock->Error()) {
|
||||
wxLogMessage(wxT("%s Client error: %s"), id, wxSock->LastError());
|
||||
wxLogError(wxT("%s client error: %s"), id, wxSock->LastError());
|
||||
ClearClient(id);
|
||||
break;
|
||||
}
|
||||
@ -164,7 +164,7 @@ void RelayServer::ReplyRequest(const sockPtr& wxSock, FrameBuffer* frame)
|
||||
switch (frame->dataType) {
|
||||
case FBT_SER_MSG_ASKCLIENTS: {
|
||||
RpyOnline(wxSock, frame);
|
||||
wxLogDebug(wxT("Reply clients to %s clients list."), frame->fid);
|
||||
wxLogMessage(wxT("Reply clients to %s clients list."), frame->fid);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -176,11 +176,11 @@ void RelayServer::ClearClient(const wxString& id)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(clientsMutex_);
|
||||
if (clients_.find(id) != clients_.end()) {
|
||||
wxLogDebug(wxT("client cleared: %s"), id);
|
||||
wxLogWarning(wxT("client cleared: %s"), id);
|
||||
clients_.erase(id);
|
||||
}
|
||||
if (threads_.find(id) != threads_.end()) {
|
||||
wxLogDebug(wxT("client thread detached: %s"), id);
|
||||
wxLogWarning(wxT("client thread detached: %s"), id);
|
||||
threads_[id].detach();
|
||||
threads_.erase(id);
|
||||
}
|
||||
|
@ -11,7 +11,10 @@ int main(int argc, char** argv)
|
||||
return -1;
|
||||
}
|
||||
auto* dl = wxLog::GetActiveTarget();
|
||||
dl->EnableLogging(true);
|
||||
dl->SetFormatter(new MLogFormatter());
|
||||
wxLog::SetLogLevel(wxLOG_Trace);
|
||||
|
||||
auto server_ = std::make_unique<RelayServer>();
|
||||
if (server_->Init("127.0.0.1", 8080)) {
|
||||
server_->Run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user