st_logger.h 746 字节
Newer Older
1 2 3 4 5 6 7
#ifndef ST_LOGGER_H
#define ST_LOGGER_H

#include <QObject>
#include <QDateTime>
#include <QDir>
#include <QByteArray>
8
#include <QMutex>
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <QCoreApplication>
namespace STMsgLogger{
	class st_logger : public QObject
	{
		Q_OBJECT
	public:
		explicit st_logger(QObject *parent = 0);
		void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg);
		int maxFileSize() const;
		int logLevel() const;
	protected:
		bool CreateNewLogFile(QCoreApplication * app);
		QFile * m_pLogFile;
		bool m_bUseLogFile;
		QString m_currLogFileName;
		int m_nLogLevel;
		int m_nMaxFileSize;
26
		QMutex m_mutextLogger;
27 28 29 30 31 32 33 34 35
	signals:

	public slots:
		void setMaxFileSize(int nSize);
		void setLogLevel(int);

	};
}
#endif // ST_LOGGER_H