thread-logging.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __THREAD_LOGGING_H__
00019 #define __THREAD_LOGGING_H__
00020
00021
00022 #include <QtCore/QMutex>
00023 #include <QtCore/QString>
00024 #include <errorlog_interfaces.h>
00025
00026
00027 class KDE_EXPORT ThreadLogging
00028 {
00029 public:
00030
00031 enum LoggingClass { LogInfo, LogWarning, LogDebug, LogError };
00032
00033 ThreadLogging();
00034
00035 bool hasLog (LoggingClass cls) const;
00036 QStringList getLogs(LoggingClass cls, bool resetLog = true);
00037
00038 QList<LoggingClass> getLogClasses() const;
00039
00040 void log (LoggingClass cls, QString logString);
00041
00042 private:
00043 mutable QMutex m_accessLock;
00044 QMap<LoggingClass, QStringList> logs;
00045 };
00046
00047
00048
00049
00050 class KDE_EXPORT ThreadLoggingClient
00051 {
00052 public:
00053 ThreadLoggingClient();
00054 virtual ~ThreadLoggingClient();
00055
00056
00057 bool checkLogs(ThreadLogging *threadLogger, QString logPrefix, bool resetLogs = true);
00058
00059
00060 protected:
00061 virtual IErrorLogClient *getErrorLogClient() = 0;
00062
00063
00064 protected:
00065
00066 bool checkLogs(ThreadLogging *threadLogger, ThreadLogging::LoggingClass cls, QString logPrefix, IErrorLogClient::logFunction_t logFunc, bool resetLog);
00067 };
00068
00069
00070 #endif
00071