ndgui/NetworkDiscovery
|
00001 /* 00002 * Copyright (c) 2010,2011 - RZ Uni Freiburg 00003 * Copyright (c) 2010,2011 - OpenSLX Project 00004 * 00005 * This program/file is free software distributed under the GPL version 2. 00006 * See http://openslx.org/COPYING 00007 * 00008 * If you have any feedback please consult http://openslx.org/feedback and 00009 * send your feedback to feedback@openslx.org 00010 * 00011 * General information about OpenSLX can be found under http://openslx.org 00012 * 00013 * 00014 * Base for custom logger engines based on QxtLogger libs. 00015 * 00016 */ 00017 #ifndef LOGGERENGINE_H_ 00018 #define LOGGERENGINE_H_ 00019 00020 #include <QxtCore> 00021 #include <QTime> 00022 #include <QTextEdit> 00023 00024 //--------------------------------------------------------------------------------------------------- 00025 // base of a custom logger engine for the framebuffer 00026 //--------------------------------------------------------------------------------------------------- 00027 class LoggerEngine_fb: public QxtLoggerEngine { 00028 public: 00029 LoggerEngine_fb(QTextEdit* parent); 00030 ~LoggerEngine_fb(); 00031 00032 // parent widget, target of messages 00033 QTextEdit *_debugConsole; 00034 bool _initialized; 00035 00036 // reimplemented virtual functions of QxtLoggerEngine 00037 void initLoggerEngine(); 00038 void killLoggerEngine(); 00039 void writeFormatted(QxtLogger::LogLevel level, const QList<QVariant> & messages); 00040 void setLogLevelEnabled(QxtLogger::LogLevels level, bool enable = true); 00041 bool isInitialized() const; 00042 00043 }; 00044 //--------------------------------------------------------------------------------------------------- 00045 // slighty modified QxtBasicSTDLoggerEngine 00046 //--------------------------------------------------------------------------------------------------- 00047 class LoggerEngine_std: public QxtBasicSTDLoggerEngine { 00048 public: 00049 LoggerEngine_std(); 00050 ~LoggerEngine_std(); 00051 00052 // reimplemented virtual functions of QxtBasicSTDLoggerEngine 00053 void writeToStdOut(const QString& level, const QList<QVariant> &msgs); 00054 void writeToStdErr(const QString& str_level, const QList<QVariant> &msgs); 00055 }; 00056 //--------------------------------------------------------------------------------------------------- 00057 // slighty modified QxtBasicFileLoggerEngine 00058 //--------------------------------------------------------------------------------------------------- 00059 class LoggerEngine_file: public QxtBasicFileLoggerEngine { 00060 public: 00061 LoggerEngine_file(const QString& logFileName); 00062 ~LoggerEngine_file(); 00063 void initLoggerEngine(); 00064 00065 // reimplemented virtual functions of QxtBasicFileLoggerEngine 00066 void writeToFile(const QString& level, const QList<QVariant> &msgs); 00067 }; 00068 00069 #endif // LOGGERENGINE_H_