Added ai command setEquipment
[ryzomcore.git] / ryzom / server / src / server_share / log_ring_gen.cpp
blobc6531a7e1b98a495a88cf4836313a4f3551ae51d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "stdpch.h"
18 #include "game_share/utils.h"
19 #include "log_ring_gen.h"
22 #include "logger_service_itf.h"
23 #include "logger_service_client.h"
25 // A function fo force linking of this code module
26 void forceLink_Ring(){}
31 class CRingDesc
33 friend class CLoggerClient;
35 /// The list of log definition for this log class
36 std::vector<LGS::TLogDefinition> _LogDefs;
38 /// Stack of context variable
41 /// Counter of 'no context' object stacked.
42 uint32 _NoContextCount;
44 public:
45 /// constructor
46 CRingDesc()
47 : _NoContextCount(0)
49 _LogDefs.resize(2);
52 LGS::TLogDefinition &logDef = _LogDefs[0];
56 logDef.setLogName("Ring_EnterSession");
57 logDef.setLogText("A character enter a ring session");
59 logDef.getParams().resize(2);
60 logDef.getListParams().resize(0);
63 logDef.getParams()[0].setName("charId");
64 logDef.getParams()[0].setType(LGS::TSupportedParamType::spt_entityId);
65 logDef.getParams()[0].setList(false);
67 logDef.getParams()[1].setName("sessionId");
68 logDef.getParams()[1].setType(LGS::TSupportedParamType::spt_uint32);
69 logDef.getParams()[1].setList(false);
74 LGS::TLogDefinition &logDef = _LogDefs[1];
78 logDef.setLogName("Ring_LeaveSession");
79 logDef.setLogText("A character leave a ring session");
81 logDef.getParams().resize(2);
82 logDef.getListParams().resize(0);
85 logDef.getParams()[0].setName("charId");
86 logDef.getParams()[0].setType(LGS::TSupportedParamType::spt_entityId);
87 logDef.getParams()[0].setList(false);
89 logDef.getParams()[1].setName("sessionId");
90 logDef.getParams()[1].setType(LGS::TSupportedParamType::spt_uint32);
91 logDef.getParams()[1].setList(false);
96 // Register the log definitions
97 LGS::ILoggerServiceClient::addLogDefinitions(_LogDefs);
100 // Context var stack accessor
103 void pushNoContext()
105 ++_NoContextCount;
107 void popNoContext()
109 nlassert(_NoContextCount > 0);
110 --_NoContextCount;
113 uint32 getNoContextCount()
115 return _NoContextCount;
119 // Instantiate the descriptor class
120 CRingDesc RingDesc;
125 /// No context context. Use this to disable any contextual log underneath
126 TLogNoContext_Ring::TLogNoContext_Ring()
128 RingDesc.pushNoContext();
131 TLogNoContext_Ring::~TLogNoContext_Ring()
133 RingDesc.popNoContext();
138 void _log_Ring_EnterSession(const NLMISC::CEntityId &charId, uint32 sessionId, const char *_filename_, uint _lineNo_)
140 static LGS::TLogInfo logInfo;
141 static bool init = false;
142 if (!init)
144 logInfo.setLogName("Ring_EnterSession");
145 logInfo.getParams().resize(2);
146 logInfo.getListParams().resize(0);
150 logInfo.getParams()[0] = LGS::TParamValue(charId);
152 logInfo.getParams()[1] = LGS::TParamValue(sessionId);
155 logInfo.setTimeStamp(NLMISC::CTime::getSecondsSince1970());
157 if (LGS::ILoggerServiceClient::isInitialized())
158 LGS::ILoggerServiceClient::getInstance()->sendLog(logInfo);
161 void _log_Ring_LeaveSession(const NLMISC::CEntityId &charId, uint32 sessionId, const char *_filename_, uint _lineNo_)
163 static LGS::TLogInfo logInfo;
164 static bool init = false;
165 if (!init)
167 logInfo.setLogName("Ring_LeaveSession");
168 logInfo.getParams().resize(2);
169 logInfo.getListParams().resize(0);
173 logInfo.getParams()[0] = LGS::TParamValue(charId);
175 logInfo.getParams()[1] = LGS::TParamValue(sessionId);
178 logInfo.setTimeStamp(NLMISC::CTime::getSecondsSince1970());
180 if (LGS::ILoggerServiceClient::isInitialized())
181 LGS::ILoggerServiceClient::getInstance()->sendLog(logInfo);