Loginserver conversion to new Logging system

This commit is contained in:
Akkadius
2015-12-09 20:30:47 -06:00
parent 22496e2ae2
commit 75cddbea71
9 changed files with 146 additions and 136 deletions
+15 -14
View File
@@ -16,13 +16,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "client_manager.h"
#include "error_log.h"
#include "login_server.h"
extern ErrorLog *server_log;
extern LoginServer server;
extern bool run_server;
#include "../common/eqemu_logsys.h"
extern EQEmuLogSys Log;
ClientManager::ClientManager()
{
int titanium_port = atoi(server.config->GetVariable("Titanium", "port").c_str());
@@ -30,18 +31,18 @@ ClientManager::ClientManager()
titanium_ops = new RegularOpcodeManager;
if(!titanium_ops->LoadOpcodes(server.config->GetVariable("Titanium", "opcodes").c_str()))
{
server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.",
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.",
server.config->GetVariable("Titanium", "opcodes").c_str());
run_server = false;
}
if(titanium_stream->Open())
{
server_log->Log(log_network, "ClientManager listening on Titanium stream.");
Log.Out(Logs::General, Logs::Login_Server, "ClientManager listening on Titanium stream.");
}
else
{
server_log->Log(log_error, "ClientManager fatal error: couldn't open Titanium stream.");
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't open Titanium stream.");
run_server = false;
}
@@ -50,18 +51,18 @@ ClientManager::ClientManager()
sod_ops = new RegularOpcodeManager;
if(!sod_ops->LoadOpcodes(server.config->GetVariable("SoD", "opcodes").c_str()))
{
server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.",
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.",
server.config->GetVariable("SoD", "opcodes").c_str());
run_server = false;
}
if(sod_stream->Open())
{
server_log->Log(log_network, "ClientManager listening on SoD stream.");
Log.Out(Logs::General, Logs::Login_Server, "ClientManager listening on SoD stream.");
}
else
{
server_log->Log(log_error, "ClientManager fatal error: couldn't open SoD stream.");
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't open SoD stream.");
run_server = false;
}
}
@@ -99,7 +100,7 @@ void ClientManager::Process()
{
struct in_addr in;
in.s_addr = cur->GetRemoteIP();
server_log->Log(log_network, "New Titanium client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
Log.Out(Logs::General, Logs::Login_Server, "New Titanium client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
cur->SetOpcodeManager(&titanium_ops);
Client *c = new Client(cur, cv_titanium);
@@ -112,7 +113,7 @@ void ClientManager::Process()
{
struct in_addr in;
in.s_addr = cur->GetRemoteIP();
server_log->Log(log_network, "New SoD client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
Log.Out(Logs::General, Logs::Login_Server, "New SoD client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
cur->SetOpcodeManager(&sod_ops);
Client *c = new Client(cur, cv_sod);
@@ -125,7 +126,7 @@ void ClientManager::Process()
{
if((*iter)->Process() == false)
{
server_log->Log(log_client, "Client had a fatal error and had to be removed from the login.");
Log.Out(Logs::General, Logs::Debug, "Client had a fatal error and had to be removed from the login.");
delete (*iter);
iter = clients.erase(iter);
}
@@ -144,7 +145,7 @@ void ClientManager::ProcessDisconnect()
std::shared_ptr<EQStream> c = (*iter)->GetConnection();
if(c->CheckClosed())
{
server_log->Log(log_network, "Client disconnected from the server, removing client.");
Log.Out(Logs::General, Logs::Login_Server, "Client disconnected from the server, removing client.");
delete (*iter);
iter = clients.erase(iter);
}
@@ -172,7 +173,7 @@ void ClientManager::RemoveExistingClient(unsigned int account_id)
{
if((*iter)->GetAccountID() == account_id)
{
server_log->Log(log_network, "Client attempting to log in and existing client already logged in, removing existing client.");
Log.Out(Logs::General, Logs::Login_Server, "Client attempting to log in and existing client already logged in, removing existing client.");
delete (*iter);
iter = clients.erase(iter);
}
@@ -200,7 +201,7 @@ Client *ClientManager::GetClient(unsigned int account_id)
if(count > 1)
{
server_log->Log(log_client_error, "More than one client with a given account_id existed in the client list.");
Log.Out(Logs::General, Logs::Error, "More than one client with a given account_id existed in the client list.");
}
return cur;
}