33 using namespace rsc::config;
38 OptionBasedConfigurator::OptionBasedConfigurator(
39 const vector<string>& rootOption) :
40 rootOption(rootOption) {
48 root.push_back(
"rsc");
49 root.push_back(
"logging");
58 const vector<string>& key)
const {
64 for (
size_t i = 0; i <
rootOption.size(); ++i) {
75 const vector<string>& key)
const {
79 for (vector<string>::const_iterator keyIt = key.begin() +
rootOption.size();
80 keyIt != key.end() - 1; ++keyIt) {
89 return name.substr(1, name.size() - 1);
95 const string& value) {
110 string setting = key.back();
111 if (setting ==
"LEVEL") {
113 if (value ==
"ALL") {
115 }
else if (value ==
"TRACE") {
117 }
else if (value ==
"DEBUG") {
119 }
else if (value ==
"INFO") {
121 }
else if (value ==
"WARN") {
123 }
else if (value ==
"ERROR") {
125 }
else if (value ==
"FATAL") {
127 }
else if (value ==
"OFF") {
131 }
else if (setting ==
"SYSTEM" && logger->getName() ==
"") {
std::vector< std::string > rootOption
virtual void handleOption(const std::vector< std::string > &key, const std::string &value)
This method is called once for each individual option available from a given ConfigSource.
std::vector< std::string > getRootOption() const
Returns the option root used by this configurator.
virtual ~OptionBasedConfigurator()
Destructor.
static LoggerPtr getLogger(const std::string &name)
Returns a logger for the given name.
bool keyStartWithRoot(const std::vector< std::string > &key) const
std::string loggerNameFromKey(const std::vector< std::string > &key) const
static LoggerFactory & getInstance()
Retrieve the singleton instance, creating it if necessary.
static std::vector< std::string > getDefaultRootOption()
Returns the default config entry assumed for the root logger.
boost::shared_ptr< Logger > LoggerPtr