mirror of
https://github.com/vmatare/thinkfan.git
synced 2024-10-26 19:38:30 +03:00
Log YAML syntax error on .conf files
This commit is contained in:
parent
9267a7e60d
commit
3811265786
@ -202,6 +202,11 @@ const Config *Config::try_read_config(const string &filename)
|
||||
} );
|
||||
if (ext == ".YAML")
|
||||
throw ConfigError(filename, e.mark, f_data, e.what());
|
||||
else {
|
||||
log(TF_INF) << "Config file " << filename << " could not be parsed as YAML." << flush;
|
||||
log(TF_DBG) << ConfigError(filename, e.mark, f_data, e.what()).what() << flush;
|
||||
log(TF_INF) << "Attempting to parse with legacy syntax because filename does not end in .yaml..." << flush;
|
||||
}
|
||||
}
|
||||
#endif //USE_YAML
|
||||
|
||||
|
@ -362,14 +362,17 @@ int main(int argc, char **argv) {
|
||||
if (daemonize) {
|
||||
{
|
||||
// Test the config before forking
|
||||
unique_ptr<const Config> test_cfg(Config::read_config(config_files));
|
||||
|
||||
LogLevel old_lvl = Logger::instance().log_lvl();
|
||||
Logger::instance().log_lvl() = TF_ERR;
|
||||
unique_ptr<const Config> test_cfg(Config::read_config(config_files));
|
||||
|
||||
temp_state = TemperatureState(test_cfg->num_temps());
|
||||
test_cfg->init_sensors(temp_state);
|
||||
test_cfg->init_fans();
|
||||
for (auto &sensor : test_cfg->sensors())
|
||||
sensor->read_temps();
|
||||
|
||||
Logger::instance().log_lvl() = old_lvl;
|
||||
// Own scope so the config gets destroyed before forking
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user