Files
mir_server/Gateway/common/log/log_sender.h
aixianling 5c9f1dae4a init
2025-01-09 17:45:40 +08:00

188 lines
4.8 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _LOG_SENDER_H_
#define _LOG_SENDER_H_
class NetClient;
class LogSender:
public NetClient
{
public:
// DC APIÈÕÖ¾
void LogDcApiLogByStr(const char* logName, const char* logContent);
// DC APIÓÎϷЭÒéÈÕÖ¾
void LogDcApiProto(const char* openId, int pf, int serverId, int roleId, int systemId, int protoId, int protoType, int protoResult, const char* svrip, const char* userip);
void LogCounter(ActorId actorid, const char* aid,
const char* user_level = "",
const char* counter = "",
const char* value = "",
const char* extra = "",
const char* kingdom = "",
const char* phylum = "",
const char* classfield = "",
const char* family = "",
const char* genus = "",
int flag = 1);
void LogInstall(const char* actorId, const char* source = "",
const char* affiliate = "",
const char* creative = "",
const char* family = "",
const char* genus = "",
const char* from_uid = "",
const char* extra = "",
int flag = 3);
void LogDau(const char* aid,
const char* source = "",
const char* affiliate = "",
const char* creative = "",
const char* family = "",
const char* genus = "",
const char* ip = "",
const char* from_uid = "",
const char* extra = "",
int flag = 3);
void LogEnconomy(ActorId actorid, const char* aid,
const char* currency = "",
const char* amount = "",
const char* value = "",
const char* kingdom = "",
const char* phylum = "",
const char* classfield = "",
const char* family = "",
const char* genus = "",
const char* extra = "",
const char* extra2 = "",
const char* pf = "",
int flag = 3,
bool isPay = true,
const char* openkey = "",
const char* pfkey = "", const char* pfid = ""); // ±íʾÊÇ·ñ³äÖµµÄÊý¾Ý
void LogMilestone(
ActorId actorid,
const char* aid,
const char* milestone = "",
const char* value = "",
const char* extra = "",
int flag = 3);
void LogPayment(int ret, ActorId actorId, const char* aid, int amount,
int mstType,
int p1,
int p2,
int p3,
int value = 1,
const char* kingdom = "",
const char* phylum = "",
const char* transactionid = "",
const char* extra = "",
int p4 = 0,
int p5 = 0,
int flag = 3);
void LogGameInfo(const char* aid,
const char* user_level = "",
const char* value = "",
const char* extra = "",
const char* kingdom = "",
const char* phylum = "",
const char* classfield = "",
const char* family = "",
const char* genus = "",
int flag = 3);
void LogChat(const char* aid,
const char* name,
const char* ip,
const char* pf,
ActorId actorid,
int type,
const char* content,
const char* toaid = "",
const char* toname = "");
// ¼Ç¼ÔÚÏßÈËÊý
void LogOnline(int cnt, int extra);
void LogTLog(const char* logstr);
void LogDKMLog(const char* logstr, const char* pf = "0");
inline int GetServerIndex()
{
return ServerIndex;
}
inline int GetServerType()
{
return ServerType;
}
inline const char* GetServerName()
{
return ServerName;
}
void SetServerIndex(const int nSerIdx)
{
ServerIndex = nSerIdx;
}
void SetServerType(const int nSrvType)
{
ServerType = nSrvType;
}
void SetServerName(const char* sServerName);
// ÊÇ·ñÍ£Ö¹¼Ç¼ÈÕÖ¾
inline void StopLog(bool flag = true)
{
stop_log_ = flag;
}
inline void StopCounterLog(bool flag = true)
{
stop_counter_log_ = flag;
}
inline void StopEconomyLog(bool flag = true)
{
stop_economy_log_ = flag;
}
public:
LogSender();
LogSender(int ServerType, int ServerIndex, char* ServerName);
~LogSender(void);
protected:
// /*** ×ÓÀàÐ踲¸ÇµÄº¯Êý¼¯ ***/
///* ´¦Àíµ¥¸öͨÐÅÊý¾Ý°ü
// * nCmd ͨÐÅÏûÏ¢ÃüÁî
// * inPacket ÒѾ­¶ÁÈ¡³öͨÐÅÃüÁîµÄÊý¾Ý°ü£¬Êý¾Ý°üµÄ¶ÁȡλÖÃÖ¸ÏòÃüÁîÊý¾ÝºóµÄÄÚÈÝ
// */
//virtual void OnRecv(const uint16_t cmd, DataPacketReader &data);
/*** ÏÂÁк¯ÊýΪ×ÓÀà¿ÉÄÜÓбØÒª¸²¸ÇµÄº¯Êý¼¯ ***/
/* ¡ï²éѯ±¾µØ·þÎñÆ÷µÄÀàÐÍ£¬ÒÔ±ãÕýÈ·µÄ·¢ËÍ×¢²áÊý¾Ý */
virtual int GetLocalServerType();
/* ¡ï²éѯ±¾µØ·þÎñÆ÷µÄÃû³Æ£¬ÒÔ±ãÕýÈ·µÄ·¢ËÍ×¢²áÊý¾Ý */
virtual const char* GetLocalServerName();
/* ¡ï²éѯ±¾µØ·þÎñÆ÷ID£¬ÒÔ±ãÕýÈ·µÄ·¢ËÍ×¢²áÊý¾Ý£¬Ä¬Èϵķµ»ØÖµÊÇ0 */
virtual int GetLocalServerIndex();
void OnConnected();
private:
//ÒÔÏÂ4¸öÖµÓÃÓÚ·¢ËÍ×¢²á°ü
int ServerType; //·þÎñÆ÷ÀàÐÍ£¬ÖµÎªSERVERTYPEö¾ÙÀàÐÍÖеÄö¾ÙÖµ
int ServerIndex; //·þÎñÆ÷Ψһ±àºÅ£¨·þÎñÆ÷±àºÅ½ö¶ÔÓÎÏ··þÎñÆ÷ÓÐÒâÒ壩
char ServerName[128]; //·þÎñÆ÷Ãû³Æ£¬Ðè°üº¬0ÖÕÖ¹·û
bool stop_log_;
bool stop_counter_log_;
bool stop_economy_log_;
};
#endif