mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-24 22:47:25 +00:00
Fixes dlogger PR
When applied this commit fixes the unix build of the previous dLogger PR. This commit also fixes backwards compatability with config files.
This commit is contained in:
parent
81d25dd574
commit
259c236b72
@ -123,6 +123,9 @@ make_directory(${CMAKE_BINARY_DIR}/res)
|
|||||||
# Create a /locale directory
|
# Create a /locale directory
|
||||||
make_directory(${CMAKE_BINARY_DIR}/locale)
|
make_directory(${CMAKE_BINARY_DIR}/locale)
|
||||||
|
|
||||||
|
# Create a /logs directory
|
||||||
|
make_directory(${CMAKE_BINARY_DIR}/logs)
|
||||||
|
|
||||||
# Copy ini files on first build
|
# Copy ini files on first build
|
||||||
if (NOT EXISTS ${PROJECT_BINARY_DIR}/authconfig.ini)
|
if (NOT EXISTS ${PROJECT_BINARY_DIR}/authconfig.ini)
|
||||||
configure_file(
|
configure_file(
|
||||||
|
@ -45,7 +45,7 @@ int main(int argc, char** argv) {
|
|||||||
dConfig config("authconfig.ini");
|
dConfig config("authconfig.ini");
|
||||||
Game::config = &config;
|
Game::config = &config;
|
||||||
Game::logger->SetLogToConsole(bool(std::stoi(config.GetValue("log_to_console"))));
|
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
|
//Connect to the MySQL Database
|
||||||
std::string mysql_host = config.GetValue("mysql_host");
|
std::string mysql_host = config.GetValue("mysql_host");
|
||||||
|
@ -48,7 +48,7 @@ int main(int argc, char** argv) {
|
|||||||
dConfig config("chatconfig.ini");
|
dConfig config("chatconfig.ini");
|
||||||
Game::config = &config;
|
Game::config = &config;
|
||||||
Game::logger->SetLogToConsole(bool(std::stoi(config.GetValue("log_to_console"))));
|
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
|
//Connect to the MySQL Database
|
||||||
std::string mysql_host = config.GetValue("mysql_host");
|
std::string mysql_host = config.GetValue("mysql_host");
|
||||||
|
@ -39,10 +39,9 @@ void dLogger::vLog(const char* format, va_list args) {
|
|||||||
mFile << "[" << timeStr << "] " << message;
|
mFile << "[" << timeStr << "] " << message;
|
||||||
#else
|
#else
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
struct tm time;
|
struct tm * time = localtime(&t);
|
||||||
localtime_s(&time, &t);
|
char timeStr[70];
|
||||||
char timeStr[70];
|
strftime(timeStr, sizeof(timeStr), "%d-%m-%y %H:%M:%S", time);
|
||||||
strftime(timeStr, sizeof(timeStr), "%d-%m-%y %H:%M:%S", &time);
|
|
||||||
char message[2048];
|
char message[2048];
|
||||||
vsprintf(message, format, args);
|
vsprintf(message, format, args);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ int main(int argc, char** argv) {
|
|||||||
dConfig config("masterconfig.ini");
|
dConfig config("masterconfig.ini");
|
||||||
Game::config = &config;
|
Game::config = &config;
|
||||||
Game::logger->SetLogToConsole(bool(std::stoi(config.GetValue("log_to_console"))));
|
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
|
//Connect to CDClient
|
||||||
try {
|
try {
|
||||||
|
@ -136,7 +136,7 @@ int main(int argc, char** argv) {
|
|||||||
dConfig config("worldconfig.ini");
|
dConfig config("worldconfig.ini");
|
||||||
Game::config = &config;
|
Game::config = &config;
|
||||||
Game::logger->SetLogToConsole(bool(std::stoi(config.GetValue("log_to_console"))));
|
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;
|
if (config.GetValue("disable_chat") == "1") chatDisabled = true;
|
||||||
|
|
||||||
// Connect to CDClient
|
// Connect to CDClient
|
||||||
|
Loading…
Reference in New Issue
Block a user