mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 00:01:28 +00:00
static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID]
enum LogCategory
This commit is contained in:
parent
489f24a80a
commit
2e397b1383
@ -20,6 +20,7 @@
|
||||
#include "eqemu_logsys.h"
|
||||
#include "string_util.h"
|
||||
#include "rulesys.h"
|
||||
#include "platform.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
@ -61,45 +62,68 @@ namespace Console {
|
||||
}
|
||||
|
||||
static const char* TypeNames[EQEmuLogSys::MaxLogID] = {
|
||||
"Status",
|
||||
"Normal",
|
||||
"Error",
|
||||
"Debug",
|
||||
"Quest",
|
||||
"Command",
|
||||
"Crash",
|
||||
"Save",
|
||||
"Status",
|
||||
"Normal",
|
||||
"Error",
|
||||
"Debug",
|
||||
"Quest",
|
||||
"Command",
|
||||
"Crash",
|
||||
"Save",
|
||||
};
|
||||
|
||||
/* 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",
|
||||
"Netcode",
|
||||
"Guilds",
|
||||
"Object",
|
||||
"Rules",
|
||||
"Skills",
|
||||
"Spawns",
|
||||
"Spells",
|
||||
"Tasks",
|
||||
"Trading",
|
||||
"Tribute",
|
||||
};
|
||||
|
||||
static Console::Color LogColors[EQEmuLogSys::MaxLogID] = {
|
||||
Console::Color::Yellow, // "Status",
|
||||
Console::Color::Yellow, // "Normal",
|
||||
Console::Color::LightRed, // "Error",
|
||||
Console::Color::LightGreen, // "Debug",
|
||||
Console::Color::LightCyan, // "Quest",
|
||||
Console::Color::LightMagenta, // "Command",
|
||||
Console::Color::LightRed // "Crash"
|
||||
Console::Color::Yellow, // "Status",
|
||||
Console::Color::Yellow, // "Normal",
|
||||
Console::Color::LightRed, // "Error",
|
||||
Console::Color::LightGreen, // "Debug",
|
||||
Console::Color::LightCyan, // "Quest",
|
||||
Console::Color::LightMagenta, // "Command",
|
||||
Console::Color::LightRed // "Crash"
|
||||
};
|
||||
|
||||
|
||||
EQEmuLogSys::EQEmuLogSys(){
|
||||
// LogSettings log_settings;
|
||||
for (int i = 0; i < EQEmuLogSys::LogCategory::MaxCategoryID; i++){
|
||||
log_settings[i].log_to_console = 1;
|
||||
std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl;
|
||||
}
|
||||
std::cout << "I AM CONSTRUCTING!!!! LUL " << std::endl;
|
||||
}
|
||||
|
||||
EQEmuLogSys::~EQEmuLogSys(){
|
||||
}
|
||||
|
||||
void EQEmuLogSys::LoadLogSettings()
|
||||
{
|
||||
log_platform = GetExecutablePlatformInt();
|
||||
std::cout << "PLATFORM " << log_platform << std::endl;
|
||||
for (int i = 0; i < EQEmuLogSys::LogCategory::MaxCategoryID; i++){
|
||||
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;
|
||||
}
|
||||
log_settings_loaded = true;
|
||||
}
|
||||
|
||||
void EQEmuLogSys::StartZoneLogs(const std::string log_name)
|
||||
{
|
||||
EQEmuLogSys::MakeDirectory("logs/zone");
|
||||
@ -149,6 +173,9 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){
|
||||
|
||||
void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...)
|
||||
{
|
||||
if (!log_settings_loaded){
|
||||
EQEmuLogSys::LoadLogSettings();
|
||||
}
|
||||
if (log_type > EQEmuLogSys::MaxLogID){
|
||||
return;
|
||||
}
|
||||
|
||||
@ -46,10 +46,26 @@ 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 */
|
||||
enum LogCategory {
|
||||
Netcode = 0,
|
||||
Guilds,
|
||||
Zone_Server = 0,
|
||||
World_Server,
|
||||
UCS_Server,
|
||||
QS_Server,
|
||||
WebInterface_Server,
|
||||
AA,
|
||||
Doors,
|
||||
Guild,
|
||||
Inventory,
|
||||
Netcode,
|
||||
Object,
|
||||
Rules,
|
||||
Skills,
|
||||
Spawns,
|
||||
Spells,
|
||||
Tasks,
|
||||
Trading,
|
||||
Tribute,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
|
||||
@ -61,6 +77,7 @@ public:
|
||||
void MakeDirectory(std::string directory_name);
|
||||
void SetCurrentTimeStamp(char* time_stamp);
|
||||
void StartZoneLogs(const std::string log_name);
|
||||
void LoadLogSettings();
|
||||
|
||||
struct LogSettings{
|
||||
uint8 log_to_file;
|
||||
@ -69,6 +86,8 @@ public:
|
||||
};
|
||||
|
||||
LogSettings log_settings[EQEmuLogSys::LogCategory::MaxCategoryID];
|
||||
bool log_settings_loaded = false;
|
||||
int log_platform = 0;
|
||||
|
||||
private:
|
||||
bool zone_general_init = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user