diff --git a/src/handler/eventHandler.cpp b/src/handler/eventHandler.cpp index 173eede..c8500a2 100644 --- a/src/handler/eventHandler.cpp +++ b/src/handler/eventHandler.cpp @@ -272,7 +272,7 @@ int EventHandler::pointerHandler(const int type, const int par1, const int par2) else { HideHourglass(); - Log::writeLog("login failed."); + Log::writeErrorLog("login failed."); } return 0; } diff --git a/src/util/log.cpp b/src/util/log.cpp index 0105bca..169f239 100644 --- a/src/util/log.cpp +++ b/src/util/log.cpp @@ -12,9 +12,19 @@ #include #include +void Log::writeInfoLog(const std::string &text) +{ + writeLog("Info:" + text); +} + +void Log::writeErrorLog(const std::string &text) +{ + writeLog("Error:" + text); +} + void Log::writeLog(const std::string &text) { - std::ofstream log(LOG_PATH + std::string("/logfile.txt"), std::ios_base::app | std::ios_base::out); + std::ofstream log(CONFIG_FOLDER + std::string("/logfile.txt"), std::ios_base::app | std::ios_base::out); time_t rawtime; struct tm *timeinfo; @@ -25,7 +35,7 @@ void Log::writeLog(const std::string &text) strftime(buffer, sizeof(buffer), "%d/%b/%Y:%H:%M:%S %z", timeinfo); - log << buffer << ":" << text << "\n"; + log << buffer << ':' << text << "\n"; log.close(); -} \ No newline at end of file +} diff --git a/src/util/log.h b/src/util/log.h index ce63924..910c499 100644 --- a/src/util/log.h +++ b/src/util/log.h @@ -17,13 +17,27 @@ class Log { public: /** - * Writes a log entry to the log file - * + * Writes a error log entry to the log file + * * @param text that shall be written to the log */ - static void writeLog(const std::string &text); + static void writeErrorLog(const std::string &text); + + /** + * Writes a info log entry to the log file + * + * @param text that shall be written to the log + */ + static void writeInfoLog(const std::string &text); private: Log() {} + + /** + * Writes a log entry to the log file + * + * @param text that shall be written to the log + */ + static void writeLog(const std::string &text); }; -#endif \ No newline at end of file +#endif