33 #include <QDataStream>
34 #include <QTextStream>
38 #define ARCS_SOURCE __FILE__":"+QString::number(__LINE__)
81 QDataStream &operator<< (QDataStream &out,
const ARCSLogEvent & event);
82 QDataStream &operator>> (QDataStream &in,
ARCSLogEvent & event);
89 QString(QString(str)+
":"+QString::number(num)) {}
118 enum Colors { NORMAL=0, GREEN, BLUE, YELLOW, RED};
121 friend std::ostream& operator<<(std::ostream& os,
const ARCSColorLog& cl);
122 friend QTextStream& operator<<(QTextStream& ts,
const ARCSColorLog& cl);
126 virtual void log(std::ostream& )
const;
127 virtual void log(QTextStream& )
const;
128 Colors getColor()
const {
return color; }
134 std::ostream& operator<<(std::ostream& os,
const ARCSColorLog& cl);
135 QTextStream& operator<<(QTextStream& ts,
const ARCSColorLog& cl);
141 ARCSWindowsColorLog(Colors color=NORMAL) :
ARCSColorLog(color) {}
145 virtual void log(std::ostream& os)
const;
148 static WORD normalAttribute;
149 static WORD getNormalAttribute();
150 static WORD attributes[];
160 virtual void log(std::ostream& os)
const;
163 static const char* normalAttribute;
164 static const char* attributes[];
175 virtual void log(std::ostream& os)
const;
176 virtual void log(QTextStream& ts)
const;
179 static const char* normalAttribute;
180 static const char* attributes[];
203 QList<ARCSLogEvent> logEvents;
206 QTextStream* textStream;
216 void startCapture() {
218 tsCapture.setString(&sCapture);
219 setTextStream(&tsCapture);
221 QString endCapture() { setTextStream();
return sCapture; }
224 void setTextStream(QTextStream* ts=0) {
225 textStream = ts; logMode = HTML; refreshMode(); }
226 void setLogMode(LogModes mode) { logMode = mode; refreshMode(); }
228 static void logInformation(QString source, QString message)
233 static void logWarning(QString source, QString message)
238 static void logError(QString source, QString message)
243 static void logCritical(QString source, QString message)
248 static const char* interp[];
254 QTextStream tsCapture;
260 #endif // __ARCSLOG_H__
ARCSLogEvent(QString src=QString::null, Level lvl=NONE, QString msg=QString::null)
Constructor of the event.
QString getSource() const
returns the source of the event
specialized log colorizer for Unix
A special QString subclass.
General purpose logging class.
class that describes a log event
for informational purpose
Level getLevel() const
returns the criticality level of the event
QString getMessage() const
returns the message associated to the event
specialized log colorizer for html output
this is a critical error, it should make the engine stop
this is an error but will not cause troubles to the engine
generic class for coloring log event