diff --git a/server/gameserver/GGListener.cc b/server/gameserver/GGListener.cc index 47011340..ad697e52 100644 --- a/server/gameserver/GGListener.cc +++ b/server/gameserver/GGListener.cc @@ -8,6 +8,7 @@ #include #include +#include #include "app.h" #include "jsondatamgr.h" @@ -49,7 +50,7 @@ public: } if (warning) { - a8::UdpLog::Instance()->Warning("收到client非法数据包", {}); + f8::UdpLog::Instance()->Warning("收到client非法数据包", {}); } } @@ -83,7 +84,7 @@ static void CreateGameClientSocket(a8::TcpSession **p) static void GSListeneron_error(a8::TcpListener*, int type, int errorid) { - a8::UdpLog::Instance()->Debug("GGListeneron_error %d %d", {type, errorid}); + f8::UdpLog::Instance()->Debug("GGListeneron_error %d %d", {type, errorid}); f8::MsgQueue::Instance()->PostMsg_r(IM_GGListenerError, a8::XParams() .SetParam1(errorid) diff --git a/server/gameserver/app.cc b/server/gameserver/app.cc index 322a27e5..24a6e381 100644 --- a/server/gameserver/app.cc +++ b/server/gameserver/app.cc @@ -11,7 +11,8 @@ #include #include -#include "f8/netmsghandler.h" +#include +#include #include "app.h" #include "jsondatamgr.h" @@ -66,7 +67,7 @@ const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log"; static void SavePerfLog() { - a8::UdpLog::Instance()->Info + f8::UdpLog::Instance()->Info ("max_rundelay:%d room_num:%d player_num:%d online_num:%d alive_count:%d " "sys_request_delay:%d user_request_delay:%d http_pending_num:%d real_alive_count:%d " "account_num:%d level0_num:%d level1_num:%d " @@ -246,7 +247,7 @@ bool App::Init(int argc, char* argv[]) GGListener::Instance()->Init(); HttpProxy::Instance()->Init(); - a8::UdpLog::Instance()->Info("gameserver starting instance_id:%d pid:%d debug_mode:%d channel:%d", + f8::UdpLog::Instance()->Info("gameserver starting instance_id:%d pid:%d debug_mode:%d channel:%d", { instance_id, getpid(), @@ -310,7 +311,7 @@ void App::UnInit() int App::Run() { int ret = 0; - a8::UdpLog::Instance()->Info("gameserver running", {}); + f8::UdpLog::Instance()->Info("gameserver running", {}); last_run_tick_ = a8::XGetTickCount(); int delta_time = 0; while (!terminated) { @@ -577,16 +578,16 @@ void App::InitLog() 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}); + f8::UdpLog::Instance()->SetLogFileName(log_file_name); + f8::UdpLog::Instance()->Init(); + f8::UdpLog::Instance()->Info("proj_root_dir:%s", {proj_root_dir}); + f8::UdpLog::Instance()->Info("proj_log_root_dir:%s", {proj_log_root_dir}); + f8::UdpLog::Instance()->Info("log_file_name:%s", {log_file_name}); } void App::UnInitLog() { - a8::UdpLog::Instance()->UnInit(); + f8::UdpLog::Instance()->UnInit(); } bool App::ParseOpt() diff --git a/server/gameserver/gridservice.cc b/server/gameserver/gridservice.cc index b6578ad1..3174e0bf 100644 --- a/server/gameserver/gridservice.cc +++ b/server/gameserver/gridservice.cc @@ -1,5 +1,7 @@ #include "precompile.h" +#include + #include "gridservice.h" #include "human.h" #include "room.h" @@ -236,7 +238,7 @@ bool GridService::InView(int grid_id, float x, float y) bool in_view = InView(grid_id, b_grid_id); #ifdef DEBUG if (in_view) { - a8::UdpLog::Instance()->Debug("InView %d %d %f %f", + f8::UdpLog::Instance()->Debug("InView %d %d %f %f", { grid_id, b_grid_id, diff --git a/server/gameserver/handlermgr.cc b/server/gameserver/handlermgr.cc index 18dd58fc..e28a7086 100644 --- a/server/gameserver/handlermgr.cc +++ b/server/gameserver/handlermgr.cc @@ -2,6 +2,8 @@ #include +#include + #include "handlermgr.h" #include "GGListener.h" @@ -33,7 +35,7 @@ static void _GMOpsReload(f8::JsonHttpRequest* request) request->resp_xobj->SetVal("errcode", 0); request->resp_xobj->SetVal("errmsg", ""); JsonDataMgr::Instance()->Reload(); - a8::UdpLog::Instance()->Info("reload config files", {}); + f8::UdpLog::Instance()->Info("reload config files", {}); } static void _GMOpsStopService(f8::JsonHttpRequest* request) diff --git a/server/gameserver/hero.cc b/server/gameserver/hero.cc index 64a309fa..b4de0564 100644 --- a/server/gameserver/hero.cc +++ b/server/gameserver/hero.cc @@ -1,5 +1,7 @@ #include "precompile.h" +#include + #include "hero.h" #include "human.h" #include "room.h" @@ -303,7 +305,7 @@ void Hero::OnAddToTargetPartObject(Entity* target) { if (delete_frameno > 0) { #if 1 - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("Hero::OnAddToTargetPartObject " "delete_frameno:%d " "room.frameno:%d", diff --git a/server/gameserver/httpproxy.cc b/server/gameserver/httpproxy.cc index 16df1775..f694dad5 100644 --- a/server/gameserver/httpproxy.cc +++ b/server/gameserver/httpproxy.cc @@ -3,6 +3,8 @@ #include #include +#include + #include "httpproxy.h" #include "app.h" #include "jsondatamgr.h" @@ -24,7 +26,7 @@ struct HttpProxyRequest static void _ProxyCallback(f8::JsonHttpRequest* request) { //#ifdef DEBUG - a8::UdpLog::Instance()->Debug("ProxyCallbBack request:%s", + f8::UdpLog::Instance()->Debug("ProxyCallbBack request:%s", { request->request.ToJsonStr() }); @@ -99,7 +101,7 @@ std::string HttpProxy::HttpGet(a8::XParams param, if (req) { long long cost_time = a8::XGetTickCount() - req->add_tick; #ifdef DEBUG - a8::UdpLog::Instance()->Debug("ProxyHttpGet ok cost_time:%d url:%s params:%s", + f8::UdpLog::Instance()->Debug("ProxyHttpGet ok cost_time:%d url:%s params:%s", { cost_time, req->url, @@ -113,7 +115,7 @@ std::string HttpProxy::HttpGet(a8::XParams param, HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(param.sender.GetString()); if (req) { long long cost_time = a8::XGetTickCount() - req->add_tick; - a8::UdpLog::Instance()->Warning("ProxyHttpGet error cost_time:%d url:%s params:%s response:%s", + f8::UdpLog::Instance()->Warning("ProxyHttpGet error cost_time:%d url:%s params:%s response:%s", { cost_time, req->url, diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index fd59ed07..af6f717d 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -6,7 +6,8 @@ #include #include -#include "f8/utils.h" +#include +#include #include "human.h" #include "cs_proto.pb.h" @@ -588,7 +589,7 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data if (!revive_timer.expired()) { countdown = std::ceil(room->xtimer.GetRemainTime(revive_timer) / SERVER_FRAME_RATE); } else { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("Human::FillMFObjectfull revive_timer == nullptr " "dead_frameno:%d dead_times:%d alive_count:%d " "room.frameno:%d", @@ -1521,7 +1522,7 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func) #ifdef DEBUG #if 0 room->CheckPartObjects(); - a8::UdpLog::Instance()->Debug("room_idx:%d syncaround begin %s %d %s", + f8::UdpLog::Instance()->Debug("room_idx:%d syncaround begin %s %d %s", { room->GetRoomIdx(), file, @@ -1542,14 +1543,14 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func) for (auto& obj : hum->part_objects) { objs_str += a8::Format("%d ", {(long long)obj}); } - a8::UdpLog::Instance()->Debug("hum1 %d %s", {(long long)hum, objs_str}); + f8::UdpLog::Instance()->Debug("hum1 %d %s", {(long long)hum, objs_str}); } { std::string objs_str; for (auto& obj : part_objects) { objs_str += a8::Format("%d ", {(long long)obj}); } - a8::UdpLog::Instance()->Debug("hum2 %d %s", {(long long)this, objs_str}); + f8::UdpLog::Instance()->Debug("hum2 %d %s", {(long long)this, objs_str}); } room->CheckPartObjects(hum, this); hum->InPartObjects(this); @@ -1560,7 +1561,7 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func) static long long last_debugout_tick = 0; if (a8::XGetTickCount() - last_debugout_tick > 1000 * 10) { last_debugout_tick = a8::XGetTickCount(); - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("SyncAroundPlayers error room_idx:%d, file:%s line:%d func:%s", { room->GetRoomIdx(), @@ -1574,7 +1575,7 @@ void Human::SyncAroundPlayers(const char* file, int line, const char* func) #ifdef DEBUG #if 0 room->CheckPartObjects(); - a8::UdpLog::Instance()->Debug("syncaround end %s %d %s", + f8::UdpLog::Instance()->Debug("syncaround end %s %d %s", { file, line, @@ -2571,7 +2572,7 @@ void Human::SendBattleSettlement() auto on_error = [] (a8::XParams& param, const std::string& response) { - a8::UdpLog::Instance()->Error("reportSettlement error params: %s response: %s", + f8::UdpLog::Instance()->Error("reportSettlement error params: %s response: %s", { param.param2, response @@ -2647,7 +2648,7 @@ void Human::SendBattleReport() auto on_error = [] (a8::XParams& param, const std::string& response) { - a8::UdpLog::Instance()->Error("battleReport http error params: %s response: %s", + f8::UdpLog::Instance()->Error("battleReport http error params: %s response: %s", { param.param2, response @@ -3174,7 +3175,7 @@ void Human::ProcDecGridList(std::set& old_grids, c->AddOutObjects(this); #ifdef DEBUG #if 0 - a8::UdpLog::Instance()->Debug("addoutobjects %d %d", + f8::UdpLog::Instance()->Debug("addoutobjects %d %d", { (long long)c, c->GetUniId() diff --git a/server/gameserver/jsondatamgr.cc b/server/gameserver/jsondatamgr.cc index 74a00243..d1681d7a 100644 --- a/server/gameserver/jsondatamgr.cc +++ b/server/gameserver/jsondatamgr.cc @@ -3,7 +3,8 @@ #include "jsondatamgr.h" #include "app.h" -#include "f8/utils.h" +#include +#include void JsonDataMgr::Init() { @@ -68,7 +69,7 @@ void JsonDataMgr::Init() server_info = a8::Format("%s:%d", {ip, listen_port}); Reload(); - a8::UdpLog::Instance()->Info("api_url:%s", + f8::UdpLog::Instance()->Info("api_url:%s", { api_url_ }); diff --git a/server/gameserver/mapinstance.cc b/server/gameserver/mapinstance.cc index c1e7d38e..5cd5d9bc 100644 --- a/server/gameserver/mapinstance.cc +++ b/server/gameserver/mapinstance.cc @@ -2,6 +2,8 @@ #include +#include + #include "DetourCommon.h" #include "mapinstance.h" @@ -69,7 +71,7 @@ void MapInstance::Init() map_meta_->pb->map_height() / MAP_GRID_WIDTH, MAP_GRID_WIDTH); CreateThings(); - a8::UdpLog::Instance()->Info + f8::UdpLog::Instance()->Info ("map_id:%d current_uniid:%d ", { map_id, diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index a12c3c99..6cadd7ac 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -4,6 +4,8 @@ #include #include +#include + #include "playermgr.h" #include "player.h" #include "cs_proto.pb.h" @@ -746,7 +748,7 @@ void Player::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg) respmsg.set_errmsg(TEXT("battle_server_reconnect_ok", "战斗重连成功")); SendNotifyMsg(respmsg); PlayerMgr::Instance()->ReBindSocket(this); - a8::UdpLog::Instance()->Debug + f8::UdpLog::Instance()->Debug ("战斗服重连成功 %s %d %d", { account_id, @@ -1533,7 +1535,7 @@ void Player::InternalRevive(int target_uniid, int revive_coin) if (!dead_timer.expired()) { room->xtimer.Delete(dead_timer); } - a8::UdpLog::Instance()->Debug + f8::UdpLog::Instance()->Debug ("InternalRevive sender:%s target:%s pos:%f,%f", { account_id, diff --git a/server/gameserver/playermgr.cc b/server/gameserver/playermgr.cc index 58e2c84a..1ba7b176 100644 --- a/server/gameserver/playermgr.cc +++ b/server/gameserver/playermgr.cc @@ -1,5 +1,7 @@ #include "precompile.h" +#include + #include "playermgr.h" #include "player.h" #include "cs_proto.pb.h" @@ -135,7 +137,7 @@ void PlayerMgr::IncAccountNum(const std::string& account_id) if (itr != account_num_hash_.end()) { ++(itr->second); if (itr->second > 3) { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ( "IncAccountNum account_id:%s num:%d > 3", { @@ -155,7 +157,7 @@ void PlayerMgr::DecAccountNum(const std::string& account_id) if (itr != account_num_hash_.end()) { --(itr->second); if (itr->second < 0) { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ( "DecAccountNum account_id:%s num:%d < 0", { @@ -168,7 +170,7 @@ void PlayerMgr::DecAccountNum(const std::string& account_id) account_num_hash_.erase(itr); } } else { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ( "DecAccountNum account_id:%s not exits", { diff --git a/server/gameserver/precompile.h b/server/gameserver/precompile.h index 1fa25f8f..6b2607f5 100644 --- a/server/gameserver/precompile.h +++ b/server/gameserver/precompile.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index fdc404be..90abf309 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -4,11 +4,11 @@ #include #include -#include #include #include -#include "f8/utils.h" +#include +#include #include "playermgr.h" #include "player.h" @@ -705,7 +705,7 @@ void Room::InternalRemoveObjectLater(Entity* entity, a8::Attacher& xtimer_attach RemoveFromEntityHash(entity); #ifdef DEBUG #if 0 - a8::UdpLog::Instance()->Debug + f8::UdpLog::Instance()->Debug ( "remove object pointer:%d uniid:%d", { @@ -1627,7 +1627,7 @@ void Room::CombineTeam() Team* team1 = team_hash_[team_id1]; Team* team2 = team_hash_[team_id2]; if (team1->GetMemberNum() + team2->GetMemberNum() > MAX_TEAM_NUM) { - a8::UdpLog::Instance()->Warning("team_member > 4 :%d", + f8::UdpLog::Instance()->Warning("team_member > 4 :%d", { team1->GetMemberNum() + team2->GetMemberNum() }); @@ -2321,7 +2321,7 @@ void Room::EnableHuman(Human* target) #ifdef DEBUG CheckPartObjects(); #if 0 - a8::UdpLog::Instance()->Debug("enablehuman %d %d", + f8::UdpLog::Instance()->Debug("enablehuman %d %d", { (long long)target, target->GetUniId() @@ -2360,7 +2360,7 @@ void Room::DisableHuman(Human* target) #ifdef DEBUG CheckPartObjects(); #if 0 - a8::UdpLog::Instance()->Debug("disablehuman %d %d", + f8::UdpLog::Instance()->Debug("disablehuman %d %d", { (long long)target, target->GetUniId() @@ -2460,7 +2460,7 @@ void Room::ProcShuaAndroid(int shua_time, int shua_num) return; } #ifdef DEBUG - a8::UdpLog::Instance()->Debug("ProcShuaAndroid room_idx:%d shua_time:%d shua_num%d real_shua_num:%d", + f8::UdpLog::Instance()->Debug("ProcShuaAndroid room_idx:%d shua_time:%d shua_num%d real_shua_num:%d", { GetRoomIdx(), shua_time, @@ -2504,7 +2504,7 @@ void Room::ProcShuaAndroid(int shua_time, int shua_num) void Room::ProcDieAndroid(int die_time, int die_num) { #ifdef DEBUG - a8::UdpLog::Instance()->Debug("ProcDieAndroid room_idx:%d die_time:%d die_num:%d", + f8::UdpLog::Instance()->Debug("ProcDieAndroid room_idx:%d die_time:%d die_num:%d", { GetRoomIdx(), die_time, @@ -2719,7 +2719,7 @@ void Room::ShuaGridRound(Human* target) } } #ifdef DEBUG - a8::UdpLog::Instance()->Debug("OnHumanGrid %d %d", {target->GetGridId(), count}); + f8::UdpLog::Instance()->Debug("OnHumanGrid %d %d", {target->GetGridId(), count}); #endif #ifdef DEBUG CheckPartObjects(); @@ -2855,7 +2855,7 @@ void Room::InitDebugInfo() [] (const a8::XParams& param) { Room* room = (Room*)param.sender.GetUserData(); - a8::UdpLog::Instance()->Debug("room_idx:%d real_alive_count:%d", + f8::UdpLog::Instance()->Debug("room_idx:%d real_alive_count:%d", { room->GetRoomIdx(), room->RealAliveCount() @@ -2867,7 +2867,7 @@ void Room::InitDebugInfo() void Room::UnInitDebugInfo() { #if 0 - a8::UdpLog::Instance()->Debug("destroy room_idx:%d", + f8::UdpLog::Instance()->Debug("destroy room_idx:%d", { GetRoomIdx() }); @@ -3206,7 +3206,7 @@ void Room::CheckShowHand() } if (alive_count_ <= (int)(real_player_num + last_human_hash_.size())) { #ifdef DEBUG - a8::UdpLog::Instance()->Debug + f8::UdpLog::Instance()->Debug ( "showHand %d %d %d %d", { @@ -3639,7 +3639,7 @@ void Room::AddTeam(class MatchTeam* team) } if (team->GetCurrMembers().size() != team->GetSlotNum()) { #if 1 - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("addTeam currMembers.size:%d slot_num:%d", { team->GetCurrMembers().size(), diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 93d122e9..5f52e3d5 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -20,8 +20,9 @@ #include "httpproxy.h" #include "config.h" -#include "f8/httpclientpool.h" -#include "f8/utils.h" +#include +#include +#include const int ROOM_NUM_UP_LIMIT = 1000; const int HUM_NUM_DOWN_LIMIT = 2500; @@ -215,7 +216,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg) PlayerMgr::Instance()->IncAccountNum(msg.account_id()); if (JsonDataMgr::Instance()->channel != 0 && JsonDataMgr::Instance()->channel != channel) { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("join room channel not match channel:%d account_id:%s", { JsonDataMgr::Instance()->channel, @@ -252,7 +253,7 @@ void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg) if (!room) { send_reconnect_failed(hdr.socket_handle, 1, TEXT("battle_server_reconnect_failreason_room_destoryed", "房间已销毁")); - a8::UdpLog::Instance()->Debug + f8::UdpLog::Instance()->Debug ("房间已销毁 %s", { msg.room_uuid() @@ -593,7 +594,7 @@ Room* RoomMgr::CreateRoom(const cs::CMJoin& msg, room_idx_hash_[room->GetRoomIdx()] = room; ++PerfMonitor::Instance()->room_num[room->GetRoomType()]; #ifdef DEBUG - a8::UdpLog::Instance()->Debug("createroom room_idx:%d room_uuid:%d room_type:%d", + f8::UdpLog::Instance()->Debug("createroom room_idx:%d room_uuid:%d room_type:%d", { room->GetRoomIdx(), room->GetRoomUuid(), @@ -620,7 +621,7 @@ void RoomMgr::JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_ GGListener::Instance()->ForceCloseChildSocket(param.sender); }); } - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("join error errcode:%d accountid:%s max_mainloop_rundelay:%d " "room_num:%d player_num:%d online_num:%d", { @@ -694,7 +695,7 @@ void RoomMgr::OnJoinRoomOk(const cs::CMJoin& msg, Player* hum) if (itr != team_hash->end()) { itr->second = hum->room->GetRoomUuid(); } else { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("team_data:%s account_id:%s not exists", { GenTeamHashData(msg.team_uuid(), team_hash), @@ -722,7 +723,7 @@ void RoomMgr::TeamRoomTimeOut(const std::string& team_uuid) } } if (!ok) { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("team match failed team_data:%s ", { GenTeamHashData(team_uuid, team_hash), @@ -730,7 +731,7 @@ void RoomMgr::TeamRoomTimeOut(const std::string& team_uuid) } team_room_hash_.erase(team_uuid); } else { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("team not found team_uuid:s", { team_uuid @@ -801,7 +802,7 @@ void RoomMgr::SendGetBattleData(int mode, void(std::vector>&)>(cb)), [] (a8::XParams& param, a8::XObject& data) { - a8::UdpLog::Instance()->Info + f8::UdpLog::Instance()->Info ("GetBattleData ok %s", { data.ToJsonStr() @@ -833,7 +834,7 @@ void RoomMgr::SendGetBattleData(int mode, }, [] (a8::XParams& param, const std::string& response) { - a8::UdpLog::Instance()->Warning + f8::UdpLog::Instance()->Warning ("GetBattleData error %s", { response diff --git a/third_party/f8 b/third_party/f8 index 42651a1c..b9b2211a 160000 --- a/third_party/f8 +++ b/third_party/f8 @@ -1 +1 @@ -Subproject commit 42651a1c9b0c841b11b0f32734c27e8d5bd6312d +Subproject commit b9b2211ab22634684728d05f8117bd96c0714a25