diff --git a/CMakeLists.txt b/CMakeLists.txt index cf7988c8..fe1f2751 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,9 @@ make_directory(${CMAKE_BINARY_DIR}/res) # Create a /locale directory make_directory(${CMAKE_BINARY_DIR}/locale) +# Create a /logs directory +make_directory(${CMAKE_BINARY_DIR}/logs) + # Copy ini files on first build if (NOT EXISTS ${PROJECT_BINARY_DIR}/authconfig.ini) configure_file( diff --git a/dAuthServer/AuthServer.cpp b/dAuthServer/AuthServer.cpp index f7ab7bbe..67590fa0 100644 --- a/dAuthServer/AuthServer.cpp +++ b/dAuthServer/AuthServer.cpp @@ -45,7 +45,7 @@ int main(int argc, char** argv) { dConfig config("authconfig.ini"); Game::config = &config; Game::logger->SetLogToConsole(bool(std::stoi(config.GetValue("log_to_console")))); - Game::logger->SetLogDebugStatements(bool(std::stoi(config.GetValue("log_debug_statements")))); + Game::logger->SetLogDebugStatements(config.GetValue("log_debug_statements") == "1"); //Connect to the MySQL Database std::string mysql_host = config.GetValue("mysql_host"); diff --git a/dChatServer/ChatServer.cpp b/dChatServer/ChatServer.cpp index 57b82721..81904d41 100644 --- a/dChatServer/ChatServer.cpp +++ b/dChatServer/ChatServer.cpp @@ -48,7 +48,7 @@ int main(int argc, char** argv) { dConfig config("chatconfig.ini"); Game::config = &config; Game::logger->SetLogToConsole(bool(std::stoi(config.GetValue("log_to_console")))); - Game::logger->SetLogDebugStatements(bool(std::stoi(config.GetValue("log_debug_statements")))); + Game::logger->SetLogDebugStatements(config.GetValue("log_debug_statements") == "1"); //Connect to the MySQL Database std::string mysql_host = config.GetValue("mysql_host"); diff --git a/dCommon/dLogger.cpp b/dCommon/dLogger.cpp index 572fc1e3..825c10cb 100644 --- a/dCommon/dLogger.cpp +++ b/dCommon/dLogger.cpp @@ -39,10 +39,9 @@ void dLogger::vLog(const char* format, va_list args) { mFile << "[" << timeStr << "] " << message; #else time_t t = time(NULL); - struct tm time; - localtime_s(&time, &t); - char timeStr[70]; - strftime(timeStr, sizeof(timeStr), "%d-%m-%y %H:%M:%S", &time); + struct tm * time = localtime(&t); + char timeStr[70]; + strftime(timeStr, sizeof(timeStr), "%d-%m-%y %H:%M:%S", time); char message[2048]; vsprintf(message, format, args); diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index 88a95a6d..e5a6f553 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -72,7 +72,7 @@ int main(int argc, char** argv) { dConfig config("masterconfig.ini"); Game::config = &config; Game::logger->SetLogToConsole(bool(std::stoi(config.GetValue("log_to_console")))); - Game::logger->SetLogDebugStatements(bool(std::stoi(config.GetValue("log_debug_statements")))); + Game::logger->SetLogDebugStatements(config.GetValue("log_debug_statements") == "1"); //Connect to CDClient try { diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 6c81e93a..ed751f41 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -136,7 +136,7 @@ int main(int argc, char** argv) { dConfig config("worldconfig.ini"); Game::config = &config; Game::logger->SetLogToConsole(bool(std::stoi(config.GetValue("log_to_console")))); - Game::logger->SetLogDebugStatements(bool(std::stoi(config.GetValue("log_debug_statements")))); + Game::logger->SetLogDebugStatements(config.GetValue("log_debug_statements") == "1"); if (config.GetValue("disable_chat") == "1") chatDisabled = true; // Connect to CDClient