mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-29 22:21:30 +00:00
More process based logging work
This commit is contained in:
parent
01940ee5ed
commit
9ae28d7619
@ -102,9 +102,16 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
log_settings[Logs::MySQLError].log_to_console = 1;
|
||||
|
||||
/* Declare process file names for log writing */
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld){ process_file_name = "world"; }
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ){ process_file_name = "query_server"; }
|
||||
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld){
|
||||
process_file_name = "world";
|
||||
}
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ){
|
||||
process_file_name = "query_server";
|
||||
}
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){
|
||||
process_file_name = "zone";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){
|
||||
@ -274,7 +281,7 @@ void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){
|
||||
struct tm * time_info;
|
||||
time(&raw_time);
|
||||
time_info = localtime(&raw_time);
|
||||
strftime(time_stamp, 80, "[%d-%m-%Y :: %H:%M:%S]", time_info);
|
||||
strftime(time_stamp, 80, "[%m-%d-%Y :: %H:%M:%S]", time_info);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::MakeDirectory(std::string directory_name){
|
||||
@ -288,19 +295,26 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){
|
||||
void EQEmuLogSys::CloseFileLogs()
|
||||
{
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){
|
||||
std::cout << "Closing down zone logs..." << std::endl;
|
||||
//std::cout << "Closing down zone logs..." << std::endl;
|
||||
}
|
||||
if (process_log.is_open()){
|
||||
process_log.close();
|
||||
}
|
||||
process_log.close();
|
||||
}
|
||||
|
||||
void EQEmuLogSys::StartFileLogs(const std::string log_name)
|
||||
{
|
||||
EQEmuLogSys::CloseFileLogs();
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){
|
||||
if (log_name != "")
|
||||
process_file_name = log_name;
|
||||
|
||||
std::cout << "Starting Zone Logs..." << std::endl;
|
||||
EQEmuLogSys::MakeDirectory("logs/zone");
|
||||
process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out);
|
||||
process_log.open(StringFormat("logs/zone/%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
}
|
||||
else{
|
||||
|
||||
std::cout << "Starting Process Log..." << std::endl;
|
||||
process_log.open(StringFormat("logs/%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
}
|
||||
}
|
||||
@ -169,6 +169,7 @@ int main(int argc, char** argv) {
|
||||
/* Register Log System and Settings */
|
||||
Log.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess);
|
||||
database.LoadLogSysSettings(Log.log_settings);
|
||||
Log.StartFileLogs("");
|
||||
|
||||
/* Guilds */
|
||||
guild_mgr.SetDatabase(&database);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user