mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
New Non-DTK store client prototype
This commit is contained in:
47
inc/spklogging.h
Normal file
47
inc/spklogging.h
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
/**
|
||||
* @brief Simple logging for Spark Store
|
||||
*/
|
||||
|
||||
#ifndef _SPKLOGGING_H_
|
||||
#define _SPKLOGGING_H_
|
||||
|
||||
#pragma push_macro("signals")
|
||||
#undef signals
|
||||
#include <libnotify/notify.h>
|
||||
#define signals DUMMY
|
||||
#pragma pop_macro("signals")
|
||||
#include <QString>
|
||||
#include <QStringListModel>
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
|
||||
class SpkLogger
|
||||
{
|
||||
QStringListModel mLogData;
|
||||
QString mLogPath;
|
||||
QFile mLogFile;
|
||||
QTextStream mLogWriter;
|
||||
static SpkLogger *Instance;
|
||||
void Initialize(QString suggestPath = "");
|
||||
bool NotifyViable = false;
|
||||
|
||||
public:
|
||||
SpkLogger(QString suggestPath = "");
|
||||
~SpkLogger();
|
||||
static SpkLogger *GetInstance() { return Instance; };
|
||||
void Log(QString message);
|
||||
void Warning(QString message);
|
||||
void Error(QString message, bool pop = false);
|
||||
void Critical(QString message);
|
||||
void Notify(QString);
|
||||
};
|
||||
|
||||
#define sLog(X) SpkLogger::GetInstance()->Log(X)
|
||||
#define sWarn(X) SpkLogger::GetInstance()->Warning(X)
|
||||
#define sErr(X) SpkLogger::GetInstance()->Error(X)
|
||||
#define sErrPop(X) SpkLogger::GetInstance()->Error(X,true)
|
||||
#define sCritical(X) SpkLogger::GetInstance()->Critical(X)
|
||||
#define sNotify(X)
|
||||
|
||||
#endif //_SPKLOGGING_H_
|
||||
Reference in New Issue
Block a user