00001 /****************************************************************************** 00002 * 00003 * package: Log4Qt 00004 * file: loggerrepository.h 00005 * created: September 2007 00006 * author: Martin Heinrich 00007 * 00008 * 00009 * Copyright 2007 Martin Heinrich 00010 * 00011 * Licensed under the Apache License, Version 2.0 (the "License"); 00012 * you may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at 00014 * 00015 * http://www.apache.org/licenses/LICENSE-2.0 00016 * 00017 * Unless required by applicable law or agreed to in writing, software 00018 * distributed under the License is distributed on an "AS IS" BASIS, 00019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 * See the License for the specific language governing permissions and 00021 * limitations under the License. 00022 * 00023 ******************************************************************************/ 00024 00025 #ifndef LOG4QT_LOGGERREPOSITORY_H 00026 #define LOG4QT_LOGGERREPOSITORY_H 00027 00028 00029 /****************************************************************************** 00030 * Dependencies 00031 ******************************************************************************/ 00032 00033 #include <QtCore/QList> 00034 #include "log4qt/level.h" 00035 00036 00037 /****************************************************************************** 00038 * Declarations 00039 ******************************************************************************/ 00040 00041 namespace Log4Qt 00042 { 00043 00044 class Logger; 00045 00050 class LoggerRepository 00051 { 00052 public: 00053 // LoggerRepository(); // Use compiler default 00054 // LoggerRepository(const LoggerRepository &rOther); // Use compiler default 00055 // virtual ~LoggerRepository(); // Use compiler default 00056 // LoggerRepository &operator=(const LoggerRepository &rOther); // Use compiler default 00057 00058 public: 00059 virtual bool exists(const QString &rName) const = 0; 00060 virtual Logger *logger(const QString &rName) = 0; 00061 // JAVA: virtual Logger *logger(const String &rName, LoggerFactory *pFactory); 00062 virtual QList<Logger *> loggers() const = 0; 00063 virtual Logger *rootLogger() const = 0; 00064 virtual Level threshold() const = 0; 00065 virtual void setThreshold(Level level) = 0; 00066 virtual void setThreshold(const QString &rThreshold) = 0; 00067 00068 virtual bool isDisabled(Level level) = 0; 00069 virtual void resetConfiguration() = 0; 00070 virtual void shutdown() = 0; 00071 00072 // JAVA: virtual void addHierarchyEventListener(HierarchyEventListener *pEventListener); 00073 // JAVA: virtual void emitNoAppenderWarning(Logger *plogger) const; 00074 // JAVA: virtual void fireAddAppenderEvent(Logger *plogger, Appender *pAppender) const; 00075 00076 protected: 00077 #ifndef QT_NO_DEBUG_STREAM 00078 00090 virtual QDebug debug(QDebug &rDebug) const = 0; 00091 friend QDebug operator<<(QDebug debug, 00092 const LoggerRepository &rLoggerRepository); 00093 #endif 00094 }; 00095 00096 00097 /****************************************************************************** 00098 * Operators, Helper 00099 ******************************************************************************/ 00100 00101 #ifndef QT_NO_DEBUG_STREAM 00102 00112 QDebug operator<<(QDebug debug, 00113 const LoggerRepository &rLoggerRepository); 00114 #endif 00115 00116 00117 /************************************************************************** 00118 * Inline 00119 **************************************************************************/ 00120 00121 00122 } // namespace Log4Qt 00123 00124 00125 // Q_DECLARE_TYPEINFO(Log4Qt::LoggerRepository, Q_COMPLEX_TYPE); // Use default 00126 00127 00128 #endif // LOG4QT_LOGGERREPOSITORY_H