提交 1f1cb63f authored 作者: blu's avatar blu

big refacting of communitation architect

上级 3d6a7e11
......@@ -213,7 +213,7 @@ int saveLocalConfigration(json &config, string fileName)
std::ofstream o(fileName);
o << std::setw(4) << config << std::endl;
}catch(exception &e) {
spdlog::error("saveLocalConfigration failed to write configuration to file {}: {}\n{}", fileName, e.what(), config.dump(4));
spdlog::error("saveLocalConfigration failed to write configuration to file {}: {}\n{}", fileName, e.what(), config.dump());
return -2;
}
......
......@@ -138,7 +138,7 @@ namespace LVDB {
ret = cb(modname, m, pUser);
cnt++;
if(ret <0) {
spdlog::error("failed to traverse and callback config on module: {}", m.dump(4));
spdlog::error("failed to traverse and callback config on module: {}", m.dump());
return ret;
}
}
......@@ -151,7 +151,7 @@ namespace LVDB {
ret = cb(mn,m, pUser);
cnt++;
if(ret <0) {
spdlog::error("failed to traverse and callback config on module: {}", m.dump(4));
spdlog::error("failed to traverse and callback config on module: {}", m.dump());
return ret;
}
}
......@@ -340,7 +340,7 @@ togo_end:
}
}
ret = setValue(value.dump(4), key,fileName, NULL);
ret = setValue(value.dump(), key,fileName, NULL);
return ret;
}
......@@ -366,7 +366,7 @@ togo_end:
// {"sn":string, "updatetime": string, "lastboot": string}
int _validateSn(const json &info) {
if(info.count("sn") == 0 || info["sn"].size() == 0) {
spdlog::error("invalid sn config:{}", info.dump(4));
spdlog::error("invalid sn config:{}", info.dump());
return -1;
}
......
......@@ -80,7 +80,7 @@ private:
json deltaCfg = json();
if(newConfig.count("data") == 0 || newConfig["data"].size() == 0) {
ret["code"] = 1;
ret["msg"] = "evcloudsvc invalid config body received: " + newConfig.dump(4);
ret["msg"] = "evcloudsvc invalid config body received: " + newConfig.dump();
spdlog::error(ret["msg"].get<string>());
}
else {
......@@ -153,7 +153,7 @@ private:
this->configMap["mod2mgr"][modKey] = k;
}
else {
string msg = "evcloudsvc invalid config: " + data.dump(4);;
string msg = "evcloudsvc invalid config: " + data.dump();;
ret["code"] = -1;
ret["msg"] = msg;
spdlog::error(msg);
......@@ -179,7 +179,7 @@ private:
//save
iret = LVDB::setLocalConfig(v, k);
if(iret < 0) {
string msg = "failed to save config " + k + " -> " + v.dump(4);
string msg = "failed to save config " + k + " -> " + v.dump();
spdlog::error(msg);
ret["code"] = iret;
ret["msg"] = msg;
......
......@@ -110,7 +110,7 @@ class EvDaemon{
}
// startup other submodules
spdlog::info("dump: {}", v.dump(4));
spdlog::info("dump: {}", v.dump());
json &ipcs = v["ipcs"];
for(auto &ipc : ipcs) {
json &modules = ipc["modules"];
......@@ -222,7 +222,7 @@ class EvDaemon{
json *cfg = cfgutils::findModuleConfig(peerId, jret["data"]);
json diff = json::diff(this->config, jret["data"]);
// TODO:
spdlog::info("evdaemon {} config diff: {}", devSn, diff.dump(4));
spdlog::info("evdaemon {} config diff: {}", devSn, diff.dump());
if(cfg == NULL) {
spdlog::error("evdaemon failed to find module {} in config {}", peerId, jret["data"].dump());
......@@ -415,7 +415,7 @@ class EvDaemon{
// its configuration message
if(meta == EV_MSG_META_CONFIG) {
if(data.size() == 0) {
spdlog::error("evdaemon {} received invalid empty config");
spdlog::error("evdaemon {} received invalid empty config", devSn);
}else{
json diff = json::diff(this->config, data);
if(diff.size() != 0) {
......@@ -424,7 +424,7 @@ class EvDaemon{
spdlog::info("evdaemon {} received cloud config diff. origin:\n{}\nnew\n{}", devSn, this->config.dump(), data.dump());
// TODO: detailed diff on submodules
}else{
spdlog::info("evdaemon {} received same configuration and ignored: {}", data.dump());
spdlog::info("evdaemon {} received same configuration and ignored: {}", devSn, data.dump());
}
}
}
......@@ -486,7 +486,7 @@ class EvDaemon{
newConfig["data"] = json::parse(req.body)["data"];
LVDB::setLocalConfig(newConfig);
spdlog::info("evmgr new config: {}", newConfig.dump(4));
spdlog::info("evmgr new config: {}", newConfig.dump());
// TODO: restart other components
//
}catch(exception &e) {
......@@ -529,7 +529,7 @@ class EvDaemon{
exit(1);
}
spdlog::info("evdaemon boot \n{}",info.dump(4));
spdlog::info("evdaemon boot \n{}",info.dump());
devSn = info["sn"];
......
......@@ -70,7 +70,7 @@ private:
//
if(config["addr"].get<string>() == "*" || config["addr"].get<string>() == "0.0.0.0") {
spdlog::error("invalid mgr address: {} in config:\n{}", config["addr"].get<string>(), config.dump(4));
spdlog::error("invalid mgr address: {} in config:\n{}", config["addr"].get<string>(), config.dump());
goto error_exit;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论