The config module doesn’t use the logger at all

This commit is contained in:
louiz’
2016-12-10 03:59:00 +01:00
parent e63f79169b
commit 4cc3dc03fc
4 changed files with 4 additions and 7 deletions
-1
View File
@@ -99,7 +99,6 @@ target_link_libraries(utils ${ICONV_LIBRARIES})
file(GLOB source_config file(GLOB source_config
config/*.[hc]pp) config/*.[hc]pp)
add_library(config STATIC ${source_config}) add_library(config STATIC ${source_config})
target_link_libraries(config utils)
# #
## logger ## logger
+3 -4
View File
@@ -1,8 +1,7 @@
#include <config/config.hpp> #include <config/config.hpp>
#include <logger/logger.hpp>
#include <iostream>
#include <cstring> #include <cstring>
#include <sstream>
#include <cstdlib> #include <cstdlib>
@@ -66,7 +65,7 @@ bool Config::read_conf(const std::string& name)
std::ifstream file(Config::filename.data()); std::ifstream file(Config::filename.data());
if (!file.is_open()) if (!file.is_open())
{ {
log_error("Error while opening file ", filename, " for reading: ", strerror(errno)); std::cerr << "Error while opening file " << filename << " for reading: " << strerror(errno) << std::endl;
return false; return false;
} }
@@ -96,7 +95,7 @@ void Config::save_to_file()
std::ofstream file(Config::filename.data()); std::ofstream file(Config::filename.data());
if (file.fail()) if (file.fail())
{ {
log_error("Could not save config file."); std::cerr << "Could not save config file." << std::endl;
return ; return ;
} }
for (const auto& it: Config::values) for (const auto& it: Config::values)
-1
View File
@@ -15,7 +15,6 @@
#pragma once #pragma once
#include <functional> #include <functional>
#include <fstream> #include <fstream>
#include <memory> #include <memory>
+1 -1
View File
@@ -8,7 +8,7 @@
TEST_CASE("Config basic") TEST_CASE("Config basic")
{ {
// Disable all output for this test // Disable all output for this test
IoTester<std::ostream> out(std::cout); IoTester<std::ostream> out(std::cerr);
// Write a value in the config file // Write a value in the config file
Config::read_conf("test.cfg"); Config::read_conf("test.cfg");
Config::set("coucou", "bonjour", true); Config::set("coucou", "bonjour", true);