aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-07-09 21:39:43 -0400
committerDeterminant <[email protected]>2018-07-09 21:39:43 -0400
commitc14b26fadcd643792960839bd1e05d7cbd39e123 (patch)
treefefc8f2d4cc654ad93c931287f8a25b1f64bccc7
parent97956c08e679299e9900e7ea1f3b42607f2f51c6 (diff)
...
-rw-r--r--include/salticidae/util.h4
-rw-r--r--src/util.cpp11
2 files changed, 7 insertions, 8 deletions
diff --git a/include/salticidae/util.h b/include/salticidae/util.h
index e51f984..05e7b66 100644
--- a/include/salticidae/util.h
+++ b/include/salticidae/util.h
@@ -48,7 +48,9 @@ class SalticidaeError: public std::exception {
public:
SalticidaeError();
SalticidaeError(const std::string &fmt, ...);
- operator std::string() const;
+
+ operator std::string() const { return msg; }
+ const char *what() const throw() override { return msg.c_str(); }
};
class Logger {
diff --git a/src/util.cpp b/src/util.cpp
index 19ec01c..a1086f8 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -80,10 +80,6 @@ SalticidaeError::SalticidaeError(const std::string &fmt, ...) {
}
}
-SalticidaeError::operator std::string() const {
- return msg;
-}
-
void Logger::write(const char *tag, const char *fmt, va_list ap) {
fprintf(output, "%s [%s %s] ", get_current_datetime().c_str(), prefix, tag);
vfprintf(output, fmt, ap);
@@ -223,10 +219,11 @@ size_t Config::parse(int argc, char **argv) {
update(*getopt_order[id], optarg);
if (id == conf_idx)
{
- if (load(conf_fname))
- SALTICIDAE_LOG_INFO("load configuration from %s", conf_fname.c_str());
+ auto &fname = opt_val_conf.get();
+ if (load(fname))
+ SALTICIDAE_LOG_INFO("loading extra configuration from %s", fname.c_str());
else
- SALTICIDAE_LOG_INFO("configuration file %s not found", conf_fname.c_str());
+ SALTICIDAE_LOG_INFO("configuration file %s not found", fname.c_str());
}
}
return optind;