Add Database::LoadLogSysSettings function

This commit is contained in:
Akkadius 2015-01-15 23:49:20 -06:00
parent 3a24372009
commit 44b65d1ee5
5 changed files with 55 additions and 26 deletions

View File

@ -4257,3 +4257,28 @@ uint32 Database::GetGuildIDByCharID(uint32 char_id)
auto row = results.begin();
return atoi(row[0]);
}
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;
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]);
std::cout << "Setting log settings for " << log_category << " " << LogCategoryName[log_category] << " " << std::endl;
std::cout << "--- log_to_console = " << atoi(row[2]) << std::endl;
std::cout << "--- log_to_file = " << atoi(row[3]) << std::endl;
std::cout << "--- log_to_gmsay = " << atoi(row[4]) << std::endl;
}
}

View File

@ -645,6 +645,9 @@ public:
void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon);
void AddReport(std::string who, std::string against, std::string lines);
/* EQEmuLogSys */
void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings);
private:
void DBInitVars();

View File

@ -20,6 +20,7 @@
#include "eqemu_logsys.h"
#include "platform.h"
#include "string_util.h"
#include "database.h"
#include <iostream>
#include <fstream>
@ -70,30 +71,6 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = {
"Crash",
};
/* If you add to this, make sure you update LogCategory in eqemu_logsys.h */
static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = {
"Zone",
"World",
"UCS",
"QueryServer",
"WebInterface",
"AA",
"Doors",
"Guild",
"Inventory",
"Launcher",
"Netcode",
"Object",
"Rules",
"Skills",
"Spawns",
"Spells",
"Tasks",
"Trading",
"Tradeskills",
"Tribute",
};
static Console::Color LogColors[EQEmuLogSys::MaxLogID] = {
Console::Color::Yellow, // "Status",
Console::Color::Yellow, // "Normal",
@ -121,7 +98,7 @@ void EQEmuLogSys::LoadLogSettings()
log_settings[i].log_to_console = 1;
log_settings[i].log_to_file = 1;
log_settings[i].log_to_gmsay = 1;
std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl;
// std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl;
}
log_settings_loaded = true;
}

View File

@ -48,7 +48,7 @@ public:
Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */
};
/* If you add to this, make sure you update LogCategoryName in eqemu_logsys.cpp */
/* If you add to this, make sure you update LogCategoryName */
enum LogCategory {
Zone_Server = 0,
World_Server,
@ -108,5 +108,28 @@ private:
extern EQEmuLogSys logger;
/* If you add to this, make sure you update LogCategory */
static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = {
"Zone",
"World",
"UCS",
"QueryServer",
"WebInterface",
"AA",
"Doors",
"Guild",
"Inventory",
"Launcher",
"Netcode",
"Object",
"Rules",
"Skills",
"Spawns",
"Spells",
"Tasks",
"Trading",
"Tradeskills",
"Tribute",
};
#endif

View File

@ -4,6 +4,7 @@
#include "../common/shareddb.h"
#include "../common/eq_packet_structs.h"
#include "../common/faction.h"
#include "../common/eqemu_logsys.h"
class Client;
class Corpse;