1 // Module: Log4CPLUS
2 // File: rootlogger.h
3 // Created: 6/2001
4 // Author: Tad E. Smith
5 //
6 //
7 // Copyright (C) Tad E. Smith All rights reserved.
8 //
9 // This software is published under the terms of the Apache Software
10 // License version 1.1, a copy of which has been included with this
11 // distribution in the LICENSE.APL file.
12 //
13
14 /** @file */
15
16 #ifndef _LOG4CPLUS_SPI_ROOT_LOGGER_HEADER_
17 #define _LOG4CPLUS_SPI_ROOT_LOGGER_HEADER_
18
19 #include <log4cplus/config.h>
20 #include <log4cplus/helpers/loglog.h>
21 #include <log4cplus/spi/loggerimpl.h>
22
23 namespace log4cplus {
24 namespace spi {
25
26 /**
27 * RootLogger sits at the top of the logger hierachy. It is a
28 * regular logger except that it provides several guarantees.
29 *
30 * <p>First, it cannot be assigned a <code>NOT_SET_LOG_LEVEL</code>
31 * LogLevel. Second, since root logger cannot have a parent, the
32 * getChainedLogLevel method always returns the value of the
33 * ll field without walking the hierarchy.
34 */
35 class LOG4CPLUS_EXPORT RootLogger : public LoggerImpl {
36 public:
37 // Ctors
38 /**
39 * The root logger names itself as "root". However, the root
40 * logger cannot be retrieved by name.
41 */
42 RootLogger(Hierarchy& h, LogLevel ll);
43
44 // Methods
45 /**
46 * Return the assigned LogLevel value without walking the logger
47 * hierarchy.
48 */
49 virtual LogLevel getChainedLogLevel() const;
50
51 /**
52 * Setting a NOT_SET_LOG_LEVEL value to the LogLevel of the root logger
53 * may have catastrophic results. We prevent this here.
54 */
55 void setLogLevel(LogLevel ll);
56
57 };
58
59 } // end namespace spi
60 } // end namespace log4cplus
61
62 #endif // _LOG4CPLUS_SPI_ROOT_LOGGER_HEADER_
syntax highlighted by Code2HTML, v. 0.9.1