From 74d3cfa5b3a23aa4454e170378323e03196bca29 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 15 Jan 2019 13:48:28 +0800 Subject: [PATCH] 1 --- server/wsproxy/app.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/server/wsproxy/app.cc b/server/wsproxy/app.cc index 9e73999..630bdc8 100644 --- a/server/wsproxy/app.cc +++ b/server/wsproxy/app.cc @@ -398,18 +398,20 @@ void App::ProcessIMMsg() void App::InitLog() { std::string filename_fmt = PROJ_LOG_FILENAME_FMT; - if (getenv("is_dev_env")) { - a8::ReplaceString(filename_fmt, "$pid", a8::XValue(0)); - } else { - a8::ReplaceString(filename_fmt, "$pid", a8::XValue(getpid())); - } + a8::ReplaceString(filename_fmt, "$pid", a8::XValue(getpid())); - a8::MkDir(a8::Format(PROJ_ROOT_FMT, {a8::Format(PROJ_NAME_FMT, {GAME_ID})})); - a8::MkDir(a8::Format(PROJ_LOG_ROOT_FMT, {a8::Format(PROJ_NAME_FMT, {GAME_ID})})); - a8::UdpLog::Instance()->SetLogFileName(a8::Format(PROJ_LOG_ROOT_FMT, - {a8::Format(PROJ_NAME_FMT, {GAME_ID})}) + "/" + filename_fmt - ); + std::string proj_root_dir = a8::Format(PROJ_ROOT_FMT, {a8::Format(PROJ_NAME_FMT,{GAME_ID})}); + std::string proj_log_root_dir = a8::Format(PROJ_LOG_ROOT_FMT, {a8::Format(PROJ_NAME_FMT, {GAME_ID})}); + std::string log_file_name = a8::Format(PROJ_LOG_ROOT_FMT, + {a8::Format(PROJ_NAME_FMT, {GAME_ID})}) + "/" + filename_fmt; + + a8::MkDir(proj_root_dir); + a8::MkDir(proj_log_root_dir); + a8::UdpLog::Instance()->SetLogFileName(log_file_name); a8::UdpLog::Instance()->Init(); + a8::UdpLog::Instance()->Info("proj_root_dir:%s", {proj_root_dir}); + a8::UdpLog::Instance()->Info("proj_log_root_dir:%s", {proj_log_root_dir}); + a8::UdpLog::Instance()->Info("log_file_name:%s", {log_file_name}); } void App::UnInitLog()