完善tglog
This commit is contained in:
parent
36aa3a8a64
commit
51f7f26e4f
@ -7,8 +7,8 @@
|
||||
#include <a8/mutable_xobject.h>
|
||||
#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<int, FILE*> opened_log_files_hash, int game_id, const std::string& filename) -> FILE*
|
||||
auto GetLogFile = [this] (std::map<int, FILE*>& 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()) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user