mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Renamed DoLog to Out as the aggregate logging function for simplicity of use and shortened syntax of Log.Out
This commit is contained in:
@@ -38,22 +38,22 @@ int main(int argc, char **argv) {
|
||||
Log.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file.");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database...");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a "
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
@@ -66,11 +66,11 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
void ExportSpells(SharedDatabase *db) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Spells...");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Spells...");
|
||||
|
||||
FILE *f = fopen("export/spells_us.txt", "w");
|
||||
if(!f) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ void ExportSpells(SharedDatabase *db) {
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
@@ -108,7 +108,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) {
|
||||
class_id, skill_id);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
class_id, skill_id, level);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
}
|
||||
|
||||
void ExportSkillCaps(SharedDatabase *db) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Skill Caps...");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Skill Caps...");
|
||||
|
||||
FILE *f = fopen("export/SkillCaps.txt", "w");
|
||||
if(!f) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,11 +169,11 @@ void ExportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ExportBaseData(SharedDatabase *db) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Base Data...");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Base Data...");
|
||||
|
||||
FILE *f = fopen("export/BaseData.txt", "w");
|
||||
if(!f) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ void ExportBaseData(SharedDatabase *db) {
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
@@ -36,22 +36,22 @@ int main(int argc, char **argv) {
|
||||
Log.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file.");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database...");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a "
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ int GetSpellColumns(SharedDatabase *db) {
|
||||
const std::string query = "DESCRIBE spells_new";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -76,10 +76,10 @@ int GetSpellColumns(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ImportSpells(SharedDatabase *db) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells...");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells...");
|
||||
FILE *f = fopen("import/spells_us.txt", "r");
|
||||
if(!f) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -142,23 +142,23 @@ void ImportSpells(SharedDatabase *db) {
|
||||
|
||||
spells_imported++;
|
||||
if(spells_imported % 1000 == 0) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported);
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
}
|
||||
|
||||
if(spells_imported % 1000 != 0) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported);
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ImportSkillCaps(SharedDatabase *db) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Skill Caps...");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Skill Caps...");
|
||||
|
||||
FILE *f = fopen("import/SkillCaps.txt", "r");
|
||||
if(!f) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,11 +190,11 @@ void ImportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ImportBaseData(SharedDatabase *db) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Base Data...");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Base Data...");
|
||||
|
||||
FILE *f = fopen("import/BaseData.txt", "r");
|
||||
if(!f) {
|
||||
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user