From a302b15c1c2b5fe3d15efddf40bcb5b8f599ca13 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 13 Feb 2022 20:35:51 +0100 Subject: [PATCH] more verbosity on config file loading --- src/ebusd/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index 7cf8234c..d270edef 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -826,6 +826,7 @@ static result_t collectConfigFiles(const string& relPath, const string& prefix, return RESULT_OK; } const string path = s_configLocalPrefix + relPathWithSlash; + logDebug(lf_main, "reading directory %s", path.c_str()); DIR* dir = opendir(path.c_str()); if (dir == nullptr) { return RESULT_ERR_NOTFOUND; @@ -837,10 +838,13 @@ static result_t collectConfigFiles(const string& relPath, const string& prefix, continue; } const string p = path + name; - struct stat stat_buf; + struct stat stat_buf = {}; if (stat(p.c_str(), &stat_buf) != 0) { + logError(lf_main, "unable to stat file %s", p.c_str()); continue; } + logDebug(lf_main, "file type of %s is %s", p.c_str(), + S_ISDIR(stat_buf.st_mode) ? "dir" : S_ISREG(stat_buf.st_mode) ? "file" : "other"); if (S_ISDIR(stat_buf.st_mode)) { if (dirs != nullptr) { dirs->push_back(relPathWithSlash + name); @@ -1044,7 +1048,7 @@ result_t loadConfigFiles(MessageMap* messages, bool verbose, bool denyRecursive) result_t result = readConfigFiles("", ".csv", (!s_opt.scanConfig || s_opt.checkConfig) && !denyRecursive, verbose, &errorDescription, messages); if (result == RESULT_OK) { - logInfo(lf_main, "read config files"); + logInfo(lf_main, "read config files, got %d messages", messages->size()); } else { logError(lf_main, "error reading config files from %s: %s, last error: %s", s_opt.configPath, getResultCode(result), errorDescription.c_str());