00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef QCTLOGGER_H
00028 #define QCTLOGGER_H
00029
00030 #include "libqtcontacts_extensions_tracker_global.h"
00031
00032 #include <QString>
00033
00035
00036 #define qctWarn(message) qctLogger().warn(message, __FILE__, __LINE__)
00037 #define qctFail(message) qctLogger().fail(message, __FILE__, __LINE__)
00038
00040
00041 class LIBQTCONTACTS_EXTENSIONS_TRACKER_EXPORT QctLogger
00042 {
00043 public:
00044 QctLogger(const QString &prefix = QString());
00045
00046 public:
00047 void setShowLocation(bool value) { m_showLocation = value; }
00048 bool showLocation() const { return m_showLocation; }
00049
00050 public:
00051 void warn(const QString &message, const char *file, int line) const;
00052 void warn(const char *message, const char *file, int line) const;
00053 void fail(const QString &message, const char *file, int line) const;
00054 void fail(const char *message, const char *file, int line) const;
00055
00056 private:
00057 static QString makePrefix(const QString &prefix);
00058
00059 private:
00060 QByteArray m_prefix;
00061 bool m_showLocation : 1;
00062 };
00063
00065
00066 LIBQTCONTACTS_EXTENSIONS_TRACKER_EXPORT QString qctTruncate(const QString &message, int limit = 500);
00067 LIBQTCONTACTS_EXTENSIONS_TRACKER_EXPORT QctLogger & qctLogger();
00068
00070
00071 #endif // QCTLOGGER_H