You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.2 KiB

  1. // -*- C++ -*-
  2. // Module: Log4CPLUS
  3. // File: rootlogger.h
  4. // Created: 6/2001
  5. // Author: Tad E. Smith
  6. //
  7. //
  8. // Copyright 2001-2010 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_ROOT_LOGGER_HEADER_
  23. #define LOG4CPLUS_SPI_ROOT_LOGGER_HEADER_
  24. #include <log4cplus/config.hxx>
  25. #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
  26. #pragma once
  27. #endif
  28. #include <log4cplus/spi/loggerimpl.h>
  29. namespace log4cplus {
  30. namespace spi {
  31. /**
  32. * RootLogger sits at the top of the logger hierachy. It is a
  33. * regular logger except that it provides several guarantees.
  34. *
  35. * First, it cannot be assigned a <code>NOT_SET_LOG_LEVEL</code>
  36. * LogLevel. Second, since root logger cannot have a parent, the
  37. * getChainedLogLevel method always returns the value of the
  38. * ll field without walking the hierarchy.
  39. */
  40. class LOG4CPLUS_EXPORT RootLogger : public LoggerImpl {
  41. public:
  42. // Ctors
  43. /**
  44. * The root logger names itself as "root". However, the root
  45. * logger cannot be retrieved by name.
  46. */
  47. RootLogger(Hierarchy& h, LogLevel ll);
  48. // Methods
  49. /**
  50. * Return the assigned LogLevel value without walking the logger
  51. * hierarchy.
  52. */
  53. virtual LogLevel getChainedLogLevel() const;
  54. /**
  55. * Setting a NOT_SET_LOG_LEVEL value to the LogLevel of the root logger
  56. * may have catastrophic results. We prevent this here.
  57. */
  58. void setLogLevel(LogLevel ll);
  59. };
  60. } // end namespace spi
  61. } // end namespace log4cplus
  62. #endif // LOG4CPLUS_SPI_ROOT_LOGGER_HEADER_