1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
18 #include "game_share/utils.h"
19 #include "log_outpost_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_Outpost(){}
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
;
52 LGS::TLogDefinition
&logDef
= _LogDefs
[0];
56 logDef
.setLogName("Outpost_Challenge");
57 logDef
.setLogText("A guild challenge an outpost");
59 logDef
.getParams().resize(3);
60 logDef
.getListParams().resize(0);
63 logDef
.getParams()[0].setName("outpostName");
64 logDef
.getParams()[0].setType(LGS::TSupportedParamType::spt_string
);
65 logDef
.getParams()[0].setList(false);
67 logDef
.getParams()[1].setName("ownerGuildName");
68 logDef
.getParams()[1].setType(LGS::TSupportedParamType::spt_string
);
69 logDef
.getParams()[1].setList(false);
71 logDef
.getParams()[2].setName("challengerGuildName");
72 logDef
.getParams()[2].setType(LGS::TSupportedParamType::spt_string
);
73 logDef
.getParams()[2].setList(false);
78 LGS::TLogDefinition
&logDef
= _LogDefs
[1];
82 logDef
.setLogName("Outpost_ChallengeWin");
83 logDef
.setLogText("The guild challenging the outpost has win");
85 logDef
.getParams().resize(4);
86 logDef
.getListParams().resize(0);
89 logDef
.getParams()[0].setName("outpostName");
90 logDef
.getParams()[0].setType(LGS::TSupportedParamType::spt_string
);
91 logDef
.getParams()[0].setList(false);
93 logDef
.getParams()[1].setName("oldOwnerGuildName");
94 logDef
.getParams()[1].setType(LGS::TSupportedParamType::spt_string
);
95 logDef
.getParams()[1].setList(false);
97 logDef
.getParams()[2].setName("newOwnerGuildName");
98 logDef
.getParams()[2].setType(LGS::TSupportedParamType::spt_string
);
99 logDef
.getParams()[2].setList(false);
101 logDef
.getParams()[3].setName("winLevel");
102 logDef
.getParams()[3].setType(LGS::TSupportedParamType::spt_uint32
);
103 logDef
.getParams()[3].setList(false);
108 LGS::TLogDefinition
&logDef
= _LogDefs
[2];
112 logDef
.setLogName("Outpost_ChallengeLost");
113 logDef
.setLogText("The guild challenging the outpost has lost");
115 logDef
.getParams().resize(3);
116 logDef
.getListParams().resize(0);
119 logDef
.getParams()[0].setName("outpostName");
120 logDef
.getParams()[0].setType(LGS::TSupportedParamType::spt_string
);
121 logDef
.getParams()[0].setList(false);
123 logDef
.getParams()[1].setName("ownerGuildName");
124 logDef
.getParams()[1].setType(LGS::TSupportedParamType::spt_string
);
125 logDef
.getParams()[1].setList(false);
127 logDef
.getParams()[2].setName("challengerGuildName");
128 logDef
.getParams()[2].setType(LGS::TSupportedParamType::spt_string
);
129 logDef
.getParams()[2].setList(false);
134 LGS::TLogDefinition
&logDef
= _LogDefs
[3];
138 logDef
.setLogName("Outpost_BuyOption");
139 logDef
.setLogText("The guild bought an option for an outpost");
141 logDef
.getParams().resize(3);
142 logDef
.getListParams().resize(0);
145 logDef
.getParams()[0].setName("outpostName");
146 logDef
.getParams()[0].setType(LGS::TSupportedParamType::spt_string
);
147 logDef
.getParams()[0].setList(false);
149 logDef
.getParams()[1].setName("ownerGuildName");
150 logDef
.getParams()[1].setType(LGS::TSupportedParamType::spt_string
);
151 logDef
.getParams()[1].setList(false);
153 logDef
.getParams()[2].setName("buildingSheet");
154 logDef
.getParams()[2].setType(LGS::TSupportedParamType::spt_sheetId
);
155 logDef
.getParams()[2].setList(false);
160 // Register the log definitions
161 LGS::ILoggerServiceClient::addLogDefinitions(_LogDefs
);
164 // Context var stack accessor
173 nlassert(_NoContextCount
> 0);
177 uint32
getNoContextCount()
179 return _NoContextCount
;
183 // Instantiate the descriptor class
184 COutpostDesc OutpostDesc
;
189 /// No context context. Use this to disable any contextual log underneath
190 TLogNoContext_Outpost::TLogNoContext_Outpost()
192 OutpostDesc
.pushNoContext();
195 TLogNoContext_Outpost::~TLogNoContext_Outpost()
197 OutpostDesc
.popNoContext();
202 void _log_Outpost_Challenge(const std::string
&outpostName
, const std::string
&ownerGuildName
, const std::string
&challengerGuildName
, const char *_filename_
, uint _lineNo_
)
204 static LGS::TLogInfo logInfo
;
205 static bool init
= false;
208 logInfo
.setLogName("Outpost_Challenge");
209 logInfo
.getParams().resize(3);
210 logInfo
.getListParams().resize(0);
214 logInfo
.getParams()[0] = LGS::TParamValue(outpostName
);
216 logInfo
.getParams()[1] = LGS::TParamValue(ownerGuildName
);
218 logInfo
.getParams()[2] = LGS::TParamValue(challengerGuildName
);
221 logInfo
.setTimeStamp(NLMISC::CTime::getSecondsSince1970());
223 if (LGS::ILoggerServiceClient::isInitialized())
224 LGS::ILoggerServiceClient::getInstance()->sendLog(logInfo
);
227 void _log_Outpost_ChallengeWin(const std::string
&outpostName
, const std::string
&oldOwnerGuildName
, const std::string
&newOwnerGuildName
, uint32 winLevel
, const char *_filename_
, uint _lineNo_
)
229 static LGS::TLogInfo logInfo
;
230 static bool init
= false;
233 logInfo
.setLogName("Outpost_ChallengeWin");
234 logInfo
.getParams().resize(4);
235 logInfo
.getListParams().resize(0);
239 logInfo
.getParams()[0] = LGS::TParamValue(outpostName
);
241 logInfo
.getParams()[1] = LGS::TParamValue(oldOwnerGuildName
);
243 logInfo
.getParams()[2] = LGS::TParamValue(newOwnerGuildName
);
245 logInfo
.getParams()[3] = LGS::TParamValue(winLevel
);
248 logInfo
.setTimeStamp(NLMISC::CTime::getSecondsSince1970());
250 if (LGS::ILoggerServiceClient::isInitialized())
251 LGS::ILoggerServiceClient::getInstance()->sendLog(logInfo
);
254 void _log_Outpost_ChallengeLost(const std::string
&outpostName
, const std::string
&ownerGuildName
, const std::string
&challengerGuildName
, const char *_filename_
, uint _lineNo_
)
256 static LGS::TLogInfo logInfo
;
257 static bool init
= false;
260 logInfo
.setLogName("Outpost_ChallengeLost");
261 logInfo
.getParams().resize(3);
262 logInfo
.getListParams().resize(0);
266 logInfo
.getParams()[0] = LGS::TParamValue(outpostName
);
268 logInfo
.getParams()[1] = LGS::TParamValue(ownerGuildName
);
270 logInfo
.getParams()[2] = LGS::TParamValue(challengerGuildName
);
273 logInfo
.setTimeStamp(NLMISC::CTime::getSecondsSince1970());
275 if (LGS::ILoggerServiceClient::isInitialized())
276 LGS::ILoggerServiceClient::getInstance()->sendLog(logInfo
);
279 void _log_Outpost_BuyOption(const std::string
&outpostName
, const std::string
&ownerGuildName
, NLMISC::CSheetId buildingSheet
, const char *_filename_
, uint _lineNo_
)
281 static LGS::TLogInfo logInfo
;
282 static bool init
= false;
285 logInfo
.setLogName("Outpost_BuyOption");
286 logInfo
.getParams().resize(3);
287 logInfo
.getListParams().resize(0);
291 logInfo
.getParams()[0] = LGS::TParamValue(outpostName
);
293 logInfo
.getParams()[1] = LGS::TParamValue(ownerGuildName
);
295 logInfo
.getParams()[2] = LGS::TParamValue(buildingSheet
);
298 logInfo
.setTimeStamp(NLMISC::CTime::getSecondsSince1970());
300 if (LGS::ILoggerServiceClient::isInitialized())
301 LGS::ILoggerServiceClient::getInstance()->sendLog(logInfo
);