feat: merge the UserOperationLog and SystemOperationLog in LogManager.

This commit is contained in:
sunwen
2024-07-29 17:46:31 +08:00
parent 9c96fbbba6
commit 2c4783674e
27 changed files with 150 additions and 104 deletions

View File

@@ -12,6 +12,24 @@ namespace
const QString logDir = "./log/UserOperationLog";
}
UserOperationLog::UserOperationLog()
: QObject()
, currentFileName()
, logFile()
, out()
{
init();
}
UserOperationLog::~UserOperationLog()
{
if (logFile.isOpen())
{
logFile.flush();
logFile.close();
}
}
void UserOperationLog::init() {
QDir log_dir("./");
if (!log_dir.exists("log")) log_dir.mkdir("log");
@@ -44,20 +62,6 @@ QString addSpace(const char* str)
return s;
}
QString getOperationName(UserOperation operation)
{
switch (operation) {
#define ADD_OPERATION(name)\
case name: return addSpace(#name);
USER_OPERATIONS()
#undef ADD_OPERATION
default:
return "unknow error";
}
}
void UserOperationLog::log(const QString& aOperationText)
{
reloadFile();