feat: merge the UserOperationLog and SystemOperationLog in LogManager.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user