mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-09 08:13:52 +00:00
Fix remaining loginserver log things
This commit is contained in:
parent
efe09f6fe5
commit
7a17089b8a
@ -20,10 +20,10 @@
|
||||
|
||||
#ifdef EQEMU_MYSQL_ENABLED
|
||||
#include "database_mysql.h"
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern EQEmuLogSys Log;
|
||||
extern LoginServer server;
|
||||
|
||||
DatabaseMySQL::DatabaseMySQL(string user, string pass, string host, string port, string name)
|
||||
@ -41,13 +41,13 @@ DatabaseMySQL::DatabaseMySQL(string user, string pass, string host, string port,
|
||||
if(!mysql_real_connect(database, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0))
|
||||
{
|
||||
mysql_close(database);
|
||||
server_log->Log(log_database, "Failed to connect to MySQL database. Error: %s", mysql_error(database));
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to MySQL database. Error: %s", mysql_error(database));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_database, "Failed to create db object in MySQL database.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to create db object in MySQL database.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -161,14 +161,14 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ void DatabaseMySQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ void DatabaseMySQL::UpdateLSAccountInfo(unsigned int id, string name, string pas
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ void DatabaseMySQL::UpdateWorldRegistration(unsigned int id, string long_name, s
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ bool DatabaseMySQL::CreateWorldRegistration(string long_name, string short_name,
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -275,13 +275,13 @@ bool DatabaseMySQL::CreateWorldRegistration(string long_name, string short_name,
|
||||
|
||||
if (mysql_query(database, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
server_log->Log(log_database, "World registration did not exist in the database for %s %s", long_name.c_str(), short_name.c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "World registration did not exist in the database for %s %s", long_name.c_str(), short_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
|
||||
extern LoginServer server;
|
||||
|
||||
#pragma comment(lib, "libpq.lib")
|
||||
@ -34,12 +34,12 @@ DatabasePostgreSQL::DatabasePostgreSQL(string user, string pass, string host, st
|
||||
db = PQsetdbLogin(host.c_str(), port.c_str(), nullptr, nullptr, name.c_str(), user.c_str(), pass.c_str());
|
||||
if(!db)
|
||||
{
|
||||
server_log->Log(log_database, "Failed to connect to PostgreSQL Database.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to PostgreSQL Database.");
|
||||
}
|
||||
|
||||
if(PQstatus(db) != CONNECTION_OK)
|
||||
{
|
||||
server_log->Log(log_database, "Failed to connect to PostgreSQL Database.");
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to PostgreSQL Database.");
|
||||
PQfinish(db);
|
||||
db = nullptr;
|
||||
}
|
||||
@ -83,7 +83,7 @@ bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &passwo
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Error, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
@ -135,7 +135,7 @@ bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_nam
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetWorldRegistration(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Error, "Database error in DatabasePostgreSQL::GetWorldRegistration(): %s", error);
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
@ -188,7 +188,7 @@ void DatabasePostgreSQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Error, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
}
|
||||
PQclear(res);
|
||||
}
|
||||
@ -225,7 +225,7 @@ void DatabasePostgreSQL::UpdateWorldRegistration(unsigned int id, string long_na
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Error, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
}
|
||||
PQclear(res);
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#ifndef EQEMU_LOGINSERVER_H
|
||||
#define EQEMU_LOGINSERVER_H
|
||||
|
||||
#include "error_log.h"
|
||||
#include "config.h"
|
||||
#include "database.h"
|
||||
#include "database_mysql.h"
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
TimeoutManager timeout_manager;
|
||||
LoginServer server;
|
||||
EQEmuLogSys Log;
|
||||
ErrorLog *server_log;
|
||||
bool run_server = true;
|
||||
|
||||
void CatchSignal(int sig_num)
|
||||
@ -45,15 +44,6 @@ int main()
|
||||
set_exception_handler();
|
||||
Log.LoadLogSettingsDefaults();
|
||||
|
||||
/* Start Loginserver log */
|
||||
time_t current_time = time(nullptr);
|
||||
std::stringstream log_name(std::stringstream::in | std::stringstream::out);
|
||||
#ifdef WIN32
|
||||
log_name << ".\\logs\\login_" << (unsigned int)current_time << ".log";
|
||||
#else
|
||||
log_name << "./logs/login_" << (unsigned int)current_time << ".log";
|
||||
#endif
|
||||
server_log = new ErrorLog(log_name.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Logging System Init.");
|
||||
|
||||
/* Parse out login.ini */
|
||||
@ -133,7 +123,6 @@ int main()
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -151,8 +140,6 @@ int main()
|
||||
delete server.db;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -173,8 +160,6 @@ int main()
|
||||
delete server.db;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -196,8 +181,6 @@ int main()
|
||||
delete server.db;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -232,8 +215,6 @@ int main()
|
||||
delete server.db;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
*/
|
||||
#include "server_manager.h"
|
||||
#include "login_server.h"
|
||||
#include "error_log.h"
|
||||
#include "login_structures.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user