loggerrepository.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /******************************************************************************
  2. *
  3. * package: Log4Qt
  4. * file: loggerrepository.h
  5. * created: September 2007
  6. * author: Martin Heinrich
  7. *
  8. *
  9. * Copyright 2007 Martin Heinrich
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. *
  23. ******************************************************************************/
  24. #ifndef LOG4QT_LOGGERREPOSITORY_H
  25. #define LOG4QT_LOGGERREPOSITORY_H
  26. /******************************************************************************
  27. * Dependencies
  28. ******************************************************************************/
  29. #include <QtCore/QList>
  30. #include "log4qt/level.h"
  31. /******************************************************************************
  32. * Declarations
  33. ******************************************************************************/
  34. namespace Log4Qt
  35. {
  36. class Logger;
  37. /*!
  38. * \brief The class LoggerRepository is abstract base class for a logger
  39. * repository.
  40. */
  41. class LoggerRepository
  42. {
  43. public:
  44. // LoggerRepository(); // Use compiler default
  45. // LoggerRepository(const LoggerRepository &rOther); // Use compiler default
  46. // virtual ~LoggerRepository(); // Use compiler default
  47. // LoggerRepository &operator=(const LoggerRepository &rOther); // Use compiler default
  48. public:
  49. virtual bool exists(const QString &rName) const = 0;
  50. virtual Logger *logger(const QString &rName) = 0;
  51. // JAVA: virtual Logger *logger(const String &rName, LoggerFactory *pFactory);
  52. virtual QList<Logger *> loggers() const = 0;
  53. virtual Logger *rootLogger() const = 0;
  54. virtual Level threshold() const = 0;
  55. virtual void setThreshold(Level level) = 0;
  56. virtual void setThreshold(const QString &rThreshold) = 0;
  57. virtual bool isDisabled(Level level) = 0;
  58. virtual void resetConfiguration() = 0;
  59. virtual void shutdown() = 0;
  60. // JAVA: virtual void addHierarchyEventListener(HierarchyEventListener *pEventListener);
  61. // JAVA: virtual void emitNoAppenderWarning(Logger *plogger) const;
  62. // JAVA: virtual void fireAddAppenderEvent(Logger *plogger, Appender *pAppender) const;
  63. protected:
  64. #ifndef QT_NO_DEBUG_STREAM
  65. /*!
  66. *\relates LoggerRepository
  67. *
  68. * Writes all object member variables to the given debug stream \a rDebug
  69. * and returns the stream.
  70. *
  71. * The member function is used by
  72. * QDebug operator<<(QDebug debug, const LoggerRepository &rLoggerRepository)
  73. * to generate class specific output.
  74. *
  75. * \sa QDebug operator<<(QDebug debug, const LoggerRepository &rLoggerRepository)
  76. */
  77. virtual QDebug debug(QDebug &rDebug) const = 0;
  78. friend QDebug operator<<(QDebug debug,
  79. const LoggerRepository &rLoggerRepository);
  80. #endif
  81. };
  82. /******************************************************************************
  83. * Operators, Helper
  84. ******************************************************************************/
  85. #ifndef QT_NO_DEBUG_STREAM
  86. /*!
  87. * \relates LoggerRepository
  88. * Writes all object member variables to the given debug stream \a debug
  89. * and returns the stream.
  90. *
  91. * To handle subclassing the function uses the virtual member function
  92. * debug(). This allows each class to generate its own output.
  93. *
  94. * \sa QDebug, debug()
  95. */
  96. QDebug operator<<(QDebug debug,
  97. const LoggerRepository &rLoggerRepository);
  98. #endif
  99. /**************************************************************************
  100. * Inline
  101. **************************************************************************/
  102. } // namespace Log4Qt
  103. // Q_DECLARE_TYPEINFO(Log4Qt::LoggerRepository, Q_COMPLEX_TYPE); // Use default
  104. #endif // LOG4QT_LOGGERREPOSITORY_H