Minor update - Log window in Ui
This commit is contained in:
@@ -40,6 +40,12 @@ public:
|
||||
Debug
|
||||
};
|
||||
|
||||
struct LogEntry
|
||||
{
|
||||
std::string message;
|
||||
LogLevel level;
|
||||
};
|
||||
|
||||
Logger()
|
||||
{
|
||||
char* appdata = nullptr;
|
||||
@@ -134,6 +140,8 @@ public:
|
||||
<< "[" << fileName << ":" << lineNumber << "] "
|
||||
<< message;
|
||||
|
||||
SendLogToUI(ss.str(), level);
|
||||
|
||||
std::ofstream file(m_logFilePath, std::ios::app);
|
||||
if (file.is_open())
|
||||
{
|
||||
@@ -142,6 +150,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void SendLogToUI(const std::string& message, LogLevel level)
|
||||
{
|
||||
m_logs.push_back({ message, level });
|
||||
}
|
||||
|
||||
const std::vector<LogEntry>& GetLogs() const
|
||||
{
|
||||
return m_logs;
|
||||
}
|
||||
|
||||
void ManageLogFiles(const std::string& directoryPath)
|
||||
{
|
||||
std::vector<std::filesystem::path> logFiles;
|
||||
@@ -189,4 +207,5 @@ private:
|
||||
std::string m_appdataPath;
|
||||
std::string m_logFileName;
|
||||
std::string m_logFilePath;
|
||||
std::vector<LogEntry> m_logs;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user