代码拉取完成,页面将自动刷新
同步操作将从 likecg/kbengine 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
This source file is part of KBEngine
For the latest info, see http://www.kbengine.org/
Copyright (c) 2008-2012 KBEngine.
KBEngine is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KBEngine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KBE_LOGGER_H
#define KBE_LOGGER_H
// common include
#include "server/kbemain.h"
#include "server/serverapp.h"
#include "server/idallocate.h"
#include "server/serverconfig.h"
#include "common/timer.h"
#include "network/endpoint.h"
#include "network/udp_packet_receiver.h"
#include "network/common.h"
#include "network/address.h"
#include "logwatcher.h"
//#define NDEBUG
#include <map>
// windows include
#if KBE_PLATFORM == PLATFORM_WIN32
#else
// linux include
#endif
namespace KBEngine{
struct LOG_ITEM
{
int32 uid;
uint32 logtype;
COMPONENT_TYPE componentType;
COMPONENT_ID componentID;
COMPONENT_ORDER componentGlobalOrder;
COMPONENT_ORDER componentGroupOrder;
int64 t;
GAME_TIME kbetime;
std::stringstream logstream;
};
class Logger: public ServerApp,
public Singleton<Logger>
{
public:
typedef std::map<Network::Address, LogWatcher> LOG_WATCHERS;
public:
enum TimeOutType
{
TIMEOUT_GAME_TICK = TIMEOUT_SERVERAPP_MAX + 1
};
Logger(Network::EventDispatcher& dispatcher,
Network::NetworkInterface& ninterface,
COMPONENT_TYPE componentType,
COMPONENT_ID componentID);
~Logger();
bool run();
void handleTimeout(TimerHandle handle, void * arg);
/* 初始化相关接口 */
bool initializeBegin();
bool inInitialize();
bool initializeEnd();
void finalise();
virtual bool canShutdown();
/** 网络接口
写日志
*/
void writeLog(Network::Channel* pChannel, KBEngine::MemoryStream& s);
/** 网络接口
注册log监听者
*/
void registerLogWatcher(Network::Channel* pChannel, KBEngine::MemoryStream& s);
/** 网络接口
注销log监听者
*/
void deregisterLogWatcher(Network::Channel* pChannel, KBEngine::MemoryStream& s);
/** 网络接口
log监听者更新自己的设置
*/
void updateLogWatcherSetting(Network::Channel* pChannel, KBEngine::MemoryStream& s);
LOG_WATCHERS& logWatchers(){ return logWatchers_; }
void sendInitLogs(LogWatcher& logWatcher);
protected:
LOG_WATCHERS logWatchers_;
std::deque<LOG_ITEM*> buffered_logs_;
};
}
#endif // KBE_LOGGER_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。