26 lines
797 B
C
26 lines
797 B
C
#ifndef LOG_H
|
|
#define LOG_H
|
|
|
|
|
|
#include <QCoreApplication>
|
|
#include <QMutex>
|
|
#include <QString>
|
|
|
|
|
|
#ifdef Q_OS_WIN32
|
|
#define LOG_FILE_NAME QCoreApplication::applicationDirPath() + QString("\\Log\\") + QDateTime::currentDateTime().toString("yyyy-MM-dd") + QString(".log")
|
|
#endif
|
|
#ifdef Q_OS_LINUX
|
|
#define LOG_FILE_NAME QCoreApplication::applicationDirPath() + QString("/Log/") + QDateTime::currentDateTime().toString("yyyy-MM-dd") + QString(".log")
|
|
#endif
|
|
static int s_logLevel = 0;
|
|
static QMutex s_logMutex;
|
|
static QString s_logPath;
|
|
|
|
void setLogPath(const QString &path);
|
|
void setLogLevel(int level);
|
|
//void customLogMessageHandler(QtMsgType type, const QMessageLogContext& ctx, const QString& msg);
|
|
void customLogMessageHandler(QtMsgType type, const QString& msg);
|
|
|
|
#endif // LOG_H
|