#include <sstream>
#include "debug.h"
#include "utility.h"
+#include "log.h"
enum ValueType
{
if(trimmedline[0] == '#')
return true;
- //dstream<<"trimmedline=\""<<trimmedline<<"\""<<std::endl;
+ //infostream<<"trimmedline=\""<<trimmedline<<"\""<<std::endl;
Strfnd sf(trim(line));
std::string value = sf.next("\n");
value = trim(value);
- /*dstream<<"Config name=\""<<name<<"\" value=\""
+ /*infostream<<"Config name=\""<<name<<"\" value=\""
<<value<<"\""<<std::endl;*/
m_settings[name] = value;
*/
std::string line;
std::getline(is, line);
- //dstream<<"got line: \""<<line<<"\""<<std::endl;
+ //infostream<<"got line: \""<<line<<"\""<<std::endl;
return parseConfigLine(line);
}
std::ifstream is(filename);
if(is.good() == false)
{
- dstream<<"Error opening configuration file \""
+ errorstream<<"Error opening configuration file \""
<<filename<<"\""<<std::endl;
return false;
}
- dstream<<"Parsing configuration file: \""
+ infostream<<"Parsing configuration file: \""
<<filename<<"\""<<std::endl;
while(parseConfigObject(is));
if(newvalue != value)
{
- dstream<<"Changing value of \""<<name<<"\" = \""
+ infostream<<"Changing value of \""<<name<<"\" = \""
<<value<<"\" -> \""<<newvalue<<"\""
<<std::endl;
}
*/
bool updateConfigFile(const char *filename)
{
- dstream<<"Updating configuration file: \""
+ infostream<<"Updating configuration file: \""
<<filename<<"\""<<std::endl;
core::list<std::string> objects;
std::ifstream is(filename);
if(is.good() == false)
{
- dstream<<"INFO: updateConfigFile():"
+ infostream<<"updateConfigFile():"
" Error opening configuration file"
" for reading: \""
<<filename<<"\""<<std::endl;
std::ofstream os(filename);
if(os.good() == false)
{
- dstream<<"Error opening configuration file"
+ errorstream<<"Error opening configuration file"
" for writing: \""
<<filename<<"\""<<std::endl;
return false;
continue;
std::string name = i.getNode()->getKey();
std::string value = i.getNode()->getValue();
- dstream<<"Adding \""<<name<<"\" = \""<<value<<"\""
+ infostream<<"Adding \""<<name<<"\" = \""<<value<<"\""
<<std::endl;
os<<name<<" = "<<value<<"\n";
}
std::string argname = argv[i];
if(argname.substr(0, 2) != "--")
{
- dstream<<"Invalid command-line parameter \""
+ errorstream<<"Invalid command-line parameter \""
<<argname<<"\": --<option> expected."<<std::endl;
return false;
}
n = allowed_options.find(name);
if(n == NULL)
{
- dstream<<"Unknown command-line parameter \""
+ errorstream<<"Unknown command-line parameter \""
<<argname<<"\""<<std::endl;
return false;
}
{
if(i >= argc)
{
- dstream<<"Invalid command-line parameter \""
+ errorstream<<"Invalid command-line parameter \""
<<name<<"\": missing value"<<std::endl;
return false;
}
}
- dstream<<"Valid command-line parameter: \""
+ infostream<<"Valid command-line parameter: \""
<<name<<"\" = \""<<value<<"\""
<<std::endl;
set(name, value);
n = m_defaults.find(name);
if(n == NULL)
{
- dstream<<"INFO: Settings: Setting not found: \""
+ infostream<<"Settings: Setting not found: \""
<<name<<"\""<<std::endl;
throw SettingNotFoundException("Setting not found");
}