From 51f7f26e4f20d17db9ccd3fb040b66bf62f083e3 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Nov 2018 15:00:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84tglog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cpp/tglog.cc | 9 ++++++--- cpp/utils.cc | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cpp/tglog.cc b/cpp/tglog.cc index e9b30f5..381739e 100644 --- a/cpp/tglog.cc +++ b/cpp/tglog.cc @@ -7,8 +7,8 @@ #include #include "tglog.h" -static const char* const TGLOG_ROOT = "/data/logs/%s/upload"; -static const char* const POLY_TGLOG_ROOT = "/data/logs/%s/%s/upload"; +static const char* const TGLOG_ROOT = "/data/logs/%s/upload/"; +static const char* const POLY_TGLOG_ROOT = "/data/logs/%s/%s/upload/"; static const char* const TGLOG_FILENAME = "log_$pid_%Y%m%d%H.log"; struct TGLogMsgNode @@ -68,6 +68,9 @@ void TGLog::Init() impl_->filename_fmt = TGLOG_FILENAME; a8::ReplaceString(impl_->filename_fmt, "$pid", a8::XValue(getpid())); + impl_->project_name = project_name_; + impl_->is_poly_log = is_poly_log_; + impl_->save_thread_shutdown = false; impl_->save_thread = new std::thread(&TGLog::SaveToFileThreadProc, this); } @@ -128,7 +131,7 @@ void TGLog::AddTrackLog(int game_id, const std::string& accountid, unsigned long void TGLog::SaveToFileThreadProc() { - auto GetLogFile = [this] (std::map opened_log_files_hash, int game_id, const std::string& filename) -> FILE* + auto GetLogFile = [this] (std::map& opened_log_files_hash, int game_id, const std::string& filename) -> FILE* { auto itr = opened_log_files_hash.find(game_id); if (itr == opened_log_files_hash.end()) { diff --git a/cpp/utils.cc b/cpp/utils.cc index 84319c6..18eee64 100644 --- a/cpp/utils.cc +++ b/cpp/utils.cc @@ -159,8 +159,8 @@ int ExtractGameIdFromAccountId(const std::string& accountid) if (strings.size() < 2) { return false; } - std::string gameid = strings[0]; - std::string channelid = strings[1]; + std::string channelid = strings[0]; + std::string gameid = strings[1]; return a8::XValue(gameid); } @@ -171,7 +171,7 @@ int ExtractChannelIdFromAccountId(const std::string& accountid) if (strings.size() < 2) { return false; } - std::string gameid = strings[0]; - std::string channelid = strings[1]; + std::string channelid = strings[0]; + std::string gameid = strings[1]; return a8::XValue(channelid); }