31 #include <boost/format.hpp> 32 #include <boost/filesystem/fstream.hpp> 34 #include "../logging/Logger.h" 35 #include "../logging/LoggerFactory.h" 50 = logging::LoggerFactory::getInstance().getLogger(
"rsc.config.configure()");
55 const string& configFileName,
56 const string& environmentVariablePrefix,
59 bool stripEnvironmentVariablePrefix,
60 const boost::filesystem::path& prefix) {
64 boost::filesystem::path
67 boost::filesystem::ifstream stream(prefixWideFile);
72 }
catch (
const runtime_error& e) {
74 "Failed to process prefix-wide configuration file `" 75 << prefixWideFile <<
"': " << e.what());
84 bool isUserConfigDirOK =
false;
86 boost::filesystem::ifstream
88 isUserConfigDirOK =
true;
93 }
catch (
const runtime_error& e) {
95 "Failed to process user-specific configuration file `" 98 :
"<failed to determine user config dir>")
99 <<
"': " << e.what());
104 boost::filesystem::ifstream stream(configFileName);
114 stripEnvironmentVariablePrefix);
void provideOptions(OptionHandler &handler)
Implementations should pass all configuration options to handler.
path userConfigDirectory()
Return the canonical directory for configuration files of the user associated with the current proces...
Objects of this class analyze the environment of the current process, finding environment variables w...
Objects of this class parse streams that contain configuration information in "ini-file" syntax...
A source for options from the command line using a -D java properties-like syntax.
void configure(OptionHandler &handler, const string &configFileName, const string &environmentVariablePrefix, int argc, const char **argv, bool stripEnvironmentVariablePrefix, const boost::filesystem::path &prefix)
Pass configuration options in from configuration files derived from configFileName and environment va...
void provideOptions(OptionHandler &handler)
Implementations should pass all configuration options to handler.
Implementations of this interface receive options from ConfigSource objects.
path prefixConfigDirectory(const path &prefix)
#define RSCWARN(logger, msg)
Provides a hierarchical logging system with the possibility to install different backends, which are instances of LoggingSystem.
void provideOptions(OptionHandler &handler)
Implementations should pass all configuration options to handler.
boost::shared_ptr< Logger > LoggerPtr