mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-18 11:42:25 +00:00
Add a copy of load log settings to UCS because of how split Database classes are laid out
This commit is contained in:
parent
e4797d04f0
commit
931134688a
@ -578,3 +578,34 @@ void Database::GetFriendsAndIgnore(int charID, std::vector<std::string> &friends
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){
|
||||||
|
std::string query =
|
||||||
|
"SELECT "
|
||||||
|
"log_category_id, "
|
||||||
|
"log_category_description, "
|
||||||
|
"log_to_console, "
|
||||||
|
"log_to_file, "
|
||||||
|
"log_to_gmsay "
|
||||||
|
"FROM "
|
||||||
|
"logsys_categories "
|
||||||
|
"ORDER BY log_category_id";
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
|
int log_category = 0;
|
||||||
|
Log.file_logs_enabled = false;
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
log_category = atoi(row[0]);
|
||||||
|
log_settings[log_category].log_to_console = atoi(row[2]);
|
||||||
|
log_settings[log_category].log_to_file = atoi(row[3]);
|
||||||
|
log_settings[log_category].log_to_gmsay = atoi(row[4]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
This determines whether or not the process needs to actually file log anything.
|
||||||
|
If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open
|
||||||
|
*/
|
||||||
|
if (log_settings[log_category].log_to_file > 0){
|
||||||
|
Log.file_logs_enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -57,7 +57,8 @@ public:
|
|||||||
void ExpireMail();
|
void ExpireMail();
|
||||||
void AddFriendOrIgnore(int CharID, int Type, std::string Name);
|
void AddFriendOrIgnore(int CharID, int Type, std::string Name);
|
||||||
void RemoveFriendOrIgnore(int CharID, int Type, std::string Name);
|
void RemoveFriendOrIgnore(int CharID, int Type, std::string Name);
|
||||||
void GetFriendsAndIgnore(int CharID, std::vector<std::string> &Friends, std::vector<std::string> &Ignorees);
|
void GetFriendsAndIgnore(int CharID, std::vector<std::string> &Friends, std::vector<std::string> &Ignorees);
|
||||||
|
void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
33
ucs/ucs.cpp
33
ucs/ucs.cpp
@ -33,25 +33,21 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
volatile bool RunLoops = true;
|
|
||||||
|
|
||||||
uint32 MailMessagesSent = 0;
|
|
||||||
uint32 ChatMessagesSent = 0;
|
|
||||||
|
|
||||||
TimeoutManager timeout_manager;
|
|
||||||
|
|
||||||
Clientlist *CL;
|
|
||||||
|
|
||||||
ChatChannelList *ChannelList;
|
ChatChannelList *ChannelList;
|
||||||
|
Clientlist *CL;
|
||||||
|
EQEmuLogSys Log;
|
||||||
|
TimeoutManager timeout_manager;
|
||||||
Database database;
|
Database database;
|
||||||
|
WorldServer *worldserver = nullptr;
|
||||||
std::string WorldShortName;
|
|
||||||
|
|
||||||
const ucsconfig *Config;
|
const ucsconfig *Config;
|
||||||
|
|
||||||
WorldServer *worldserver = nullptr;
|
std::string WorldShortName;
|
||||||
EQEmuLogSys Log;
|
|
||||||
|
uint32 ChatMessagesSent = 0;
|
||||||
|
uint32 MailMessagesSent = 0;
|
||||||
|
|
||||||
|
volatile bool RunLoops = true;
|
||||||
|
|
||||||
void CatchSignal(int sig_num) {
|
void CatchSignal(int sig_num) {
|
||||||
|
|
||||||
@ -80,10 +76,8 @@ int main() {
|
|||||||
|
|
||||||
Log.Out(Logs::General, Logs::UCS_Server, "Starting EQEmu Universal Chat Server.");
|
Log.Out(Logs::General, Logs::UCS_Server, "Starting EQEmu Universal Chat Server.");
|
||||||
|
|
||||||
if (!ucsconfig::LoadConfig()) {
|
if (!ucsconfig::LoadConfig()) {
|
||||||
|
Log.Out(Logs::General, Logs::UCS_Server, "Loading server configuration failed.");
|
||||||
Log.Out(Logs::General, Logs::UCS_Server, "Loading server configuration failed.");
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +97,9 @@ int main() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Register Log System and Settings */
|
||||||
|
database.LoadLogSysSettings(Log.log_settings);
|
||||||
|
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
|
|
||||||
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
|
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user