loggerfactory.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // -*- C++ -*-
  2. // Module: Log4CPLUS
  3. // File: loggerfactory.h
  4. // Created: 6/2001
  5. // Author: Tad E. Smith
  6. //
  7. //
  8. // Copyright 2001-2017 Tad E. Smith
  9. //
  10. // Licensed under the Apache License, Version 2.0 (the "License");
  11. // you may not use this file except in compliance with the License.
  12. // You may obtain a copy of the License at
  13. //
  14. // http://www.apache.org/licenses/LICENSE-2.0
  15. //
  16. // Unless required by applicable law or agreed to in writing, software
  17. // distributed under the License is distributed on an "AS IS" BASIS,
  18. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. // See the License for the specific language governing permissions and
  20. // limitations under the License.
  21. /** @file */
  22. #ifndef LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER
  23. #define LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER
  24. #include <log4cplus/config.hxx>
  25. #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
  26. #pragma once
  27. #endif
  28. #include <log4cplus/tstring.h>
  29. namespace log4cplus {
  30. // Forward Declarations
  31. class Logger;
  32. class Hierarchy;
  33. namespace spi {
  34. class LoggerImpl;
  35. /**
  36. * Implement this interface to create new instances of Logger or
  37. * a sub-class of Logger.
  38. */
  39. class LOG4CPLUS_EXPORT LoggerFactory {
  40. public:
  41. /**
  42. * Creates a new <code>Logger</code> object.
  43. */
  44. virtual Logger makeNewLoggerInstance(const log4cplus::tstring& name,
  45. Hierarchy& h) = 0;
  46. virtual ~LoggerFactory() = 0;
  47. protected:
  48. virtual LoggerImpl * makeNewLoggerImplInstance(
  49. const log4cplus::tstring& name, Hierarchy& h) = 0;
  50. };
  51. } // end namespace spi
  52. } // end namespace log4cplus
  53. #endif // LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER