summaryrefslogtreecommitdiff
path: root/louloulibs/config
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-07-24 19:41:01 +0200
committerlouiz’ <louiz@louiz.org>2016-07-24 20:03:34 +0200
commitdb503b23e86d1cb390d12298875eb0eaffdbfa3c (patch)
tree046775d13d3738bf6478306d152cb0517c4d30eb /louloulibs/config
parent7cc05ab4967e9fb77b6e4d8ca9800c8625895ad3 (diff)
downloadbiboumi-db503b23e86d1cb390d12298875eb0eaffdbfa3c.tar.gz
biboumi-db503b23e86d1cb390d12298875eb0eaffdbfa3c.tar.bz2
biboumi-db503b23e86d1cb390d12298875eb0eaffdbfa3c.tar.xz
biboumi-db503b23e86d1cb390d12298875eb0eaffdbfa3c.zip
Use log_error instead of cerr
Diffstat (limited to 'louloulibs/config')
-rw-r--r--louloulibs/config/config.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/louloulibs/config/config.cpp b/louloulibs/config/config.cpp
index 8027d20..417981d 100644
--- a/louloulibs/config/config.cpp
+++ b/louloulibs/config/config.cpp
@@ -1,9 +1,10 @@
#include <config/config.hpp>
+#include <logger/logger.hpp>
-#include <iostream>
+#include <cstring>
#include <sstream>
-#include <stdlib.h>
+#include <cstdlib>
std::string Config::filename{};
std::map<std::string, std::string> Config::values{};
@@ -22,7 +23,7 @@ int Config::get_int(const std::string& option, const int& def)
{
std::string res = Config::get(option, "");
if (!res.empty())
- return atoi(res.c_str());
+ return std::atoi(res.c_str());
else
return def;
}
@@ -65,7 +66,7 @@ bool Config::read_conf(const std::string& name)
std::ifstream file(Config::filename.data());
if (!file.is_open())
{
- perror(("Error while opening file " + filename + " for reading.").c_str());
+ log_error("Error while opening file ", filename, " for reading: ", strerror(errno));
return false;
}
@@ -95,7 +96,7 @@ void Config::save_to_file()
std::ofstream file(Config::filename.data());
if (file.fail())
{
- std::cerr << "Could not save config file." << std::endl;
+ log_error("Could not save config file.");
return ;
}
for (const auto& it: Config::values)