diff options
Diffstat (limited to 'request/config.cpp')
-rw-r--r-- | request/config.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/request/config.cpp b/request/config.cpp index 3e0a2eb..afae8b4 100644 --- a/request/config.cpp +++ b/request/config.cpp @@ -34,7 +34,7 @@ void Tconfig::load_settings_from_config_file(){ file.open(config_file_name.c_str()); } catch(...){ - merror("Error opening settings file: "+config_file_name+". Default settings will be used. Check if config file: "+config_file_name+" exists and segget has rights to access it."); + printout("Error opening settings file: "+config_file_name+". Default settings will be used. Check if config file: "+config_file_name+" exists and segget has rights to access it."); return; } try{ @@ -61,14 +61,14 @@ void Tconfig::load_settings_from_config_file(){ } }catch(ifstream::failure e){ if (!file.eof()){ - merror("Settings file: "+config_file_name+" was opened, but an error occured while reading it."); + printout("Settings file: "+config_file_name+" was opened, but an error occured while reading it."); return; } }catch(...){ - merror("Settings file: "+config_file_name+" was opened, but an error occured while reading settings from it."); + printout("Settings file: "+config_file_name+" was opened, but an error occured while reading settings from it."); } }catch(...){ - merror("Error in config.cpp: load_settings_from_config_file()"); + printout("Error in config.cpp: load_settings_from_config_file()"); } } @@ -76,17 +76,17 @@ int Tconfig::set(string const& section, string const& entry, string &dst) const try{ map<string,string>::const_iterator ci = content_.find(section + '/' + entry); if (ci == content_.end()){ - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set."); - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+dst+". Default value forced."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+dst+". Default value forced."); return 1; } else{ dst=ci->second; - merror("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+dst); + printout("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+dst); return 0; } }catch(...){ - merror("Error in config.cpp: set(string &dst, string const& section, string const& entry)"); + printout("Error in config.cpp: set(string &dst, string const& section, string const& entry)"); return 1; } } @@ -95,37 +95,37 @@ int Tconfig::set(string const& section, string const& entry, ulong &dst, uint co uint return_value; map<string,string>::const_iterator ci = content_.find(section + '/' + entry); if (ci == content_.end()){ - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set."); - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); return 1; } else{ return_value=atoi(ci->second.c_str()); if (return_value==0) if (toString(return_value)!=ci->second){ - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry +" must have an integer value in range from "+toString(min_limit) +" to "+toString(max_limit) +". Can't convert "+ci->second +" to integer. "); - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); return 1; } if ((return_value>=min_limit) and (return_value<=max_limit)){ //everything is ok - merror("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(return_value)); + printout("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(return_value)); dst=return_value; return 0; }else{ - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry +" must have an integer value in range from "+toString(min_limit) +" to "+toString(max_limit)+"."); - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); return 1; } } }catch(...){ - merror("Error in config.cpp: set(ulong &dst, string const& section, string const& entry, uint const& min_limit, uint const& max_limit)"); + printout("Error in config.cpp: set(ulong &dst, string const& section, string const& entry, uint const& min_limit, uint const& max_limit)"); return 1; } } @@ -135,35 +135,35 @@ int Tconfig::set(string const& section, string const& entry, bool &dst) const { uint return_value; map<std::string,string>::const_iterator ci = content_.find(section + '/' + entry); if (ci == content_.end()){ - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set."); - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); return 1; } else{ return_value=atoi(ci->second.c_str()); if (return_value==0) if (toString(return_value)!=ci->second){ - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry +" must have a boolean value: 0 or 1" +". Can't convert "+ci->second +" to 0 or 1. "); - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); return 1; } if ((return_value==0) or (return_value==1)){ //everything is ok - merror("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(return_value)); + printout("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(return_value)); dst=return_value; return 0; }else{ - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry +" must have a boolean value: 0 or 1"); - merror("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); + printout("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced."); return 1; } } }catch(...){ - merror("Error in config.cpp: set(bool &dst, string const& section, string const& entry)"); + printout("Error in config.cpp: set(bool &dst, string const& section, string const& entry)"); return 1; } } @@ -172,6 +172,6 @@ void Tconfig::clear(){ try{ content_.clear(); }catch(...){ - merror("Error in config.cpp: clear()"); + printout("Error in config.cpp: clear()"); } }
\ No newline at end of file |