lichao
2021-05-26 a011a040996dd4cdb0152aae2206aebc7f4f7034
refactor, log dir.
4个文件已修改
13 ■■■■ 已修改文件
box/center_main.cc 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/bh_api.cc 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/defs.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/defs.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
box/center_main.cc
@@ -92,7 +92,7 @@
        return 0;
    }
    ns_log::AddLog("/opt/vasystem/valog/bhshmq_center.log");
    ns_log::AddLog(BHLogDir() + "bhshmq_center.log");
    auto lvl = args.Get("log", "info");
    if (strcasecmp(lvl.c_str(), "trace") == 0) { ns_log::ResetLogLevel(ns_log::LogLevel::trace); }
    if (strcasecmp(lvl.c_str(), "debug") == 0) { ns_log::ResetLogLevel(ns_log::LogLevel::debug); }
src/bh_api.cc
@@ -36,10 +36,7 @@
    static std::unique_ptr<TopicNode> ptr;
    if (!ptr && GlobalInit(BHomeShm())) {
        auto InitLog = []() {
            auto id = GetProcExe();
            char path[200] = {0};
            sprintf(path, "/opt/vasystem/valog/bhshmq_node_%s.log", id.c_str());
            ns_log::AddLog(path);
            ns_log::AddLog(BHLogDir() + "bhshmq_node_" + GetProcExe() + ".log");
            return true;
        };
        static bool init_log = InitLog();
src/defs.cpp
@@ -207,4 +207,6 @@
    msg = LastErrorStore().msg_;
}
int NodeTimeoutSec() { return 60; }
int NodeTimeoutSec() { return 60; }
std::string BHLogDir() { return "/opt/vasystem/valog/"; }
src/defs.h
@@ -74,4 +74,6 @@
// node mq is avail with in timeout; after that may get killed.
int NodeTimeoutSec();
std::string BHLogDir();
#endif // end of include guard: DEFS_KP8LKGD0