Project

General

Profile

Actions

Game Log » History » Revision 4

« Previous | Revision 4/5 (diff) | Next »
Master Chief, 2020-02-11 08:20


<h1>게임 로그</h1>

<p>로그는 게임 서비스에서 매우 중요한 역할을 차지합니다. <u>LE_HACK</u> , <u>LE_CLIENT_IN</u> , <u>LE_CLIENT_OUT</u> , <u>LE_CHAT_CHANNEL</u> , <u>LE_ROOM_CREATE</u> , <u>LE_ROOM_JOIN</u> , <u>LE_ROOM_END</u> , <u>LE_ITEM_BUY</u> , <u>LE_ITEM_SELL</u> , <u>LE_ITEM_DESTRUCT</u> , <u>LE_ITEM_USE</u> 등은 서비스 운영에 반드시 필요한 것들이며 <u>LE_BUG</u> 역시 서비스 안정화에 필요합니다.</p>

<blockquote>
<p>어떠한 뛰어난 개발자라도 완벽히 모든 상황을 예측할수 없습니다. 서버 코드 작성중에 조건문 분기시 들어가서는 안되는 위치에 <u>LE_BUG</u> 를 남겨주세요. 파일 위치, 라인 위치, 추적을 위한 오류 메세지 등이 필요합니다.</p>
</blockquote>

<p>이제 서버 개발자가 할일은 서식있는 로그를 남기는 것입니다.</p>

&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;LOG_EVENT_TYPE&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;LE_SERVER_START&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LE_SERVER_STOP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LE_HACK&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LE_BUG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LE_CLIENT_IN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LE_CLIENT_OUT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LE_CHAT_CHANNEL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LE_ROOM_CREATE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;26&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LE_ROOM_JOIN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;27&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

<p><strong>LE_HACK 필드 서식</strong></p>

<p><u>LF_AID</u> , iAccountId, <u>LF_DEBUG</u> , iLineNumber, <u>LF_STRING</u> , szMessage</p>

<p><strong>LE_BUG 필드 서식</strong></p>

<p><u>LF_AID</u> , iAccountId, <u>LF_DEBUG</u> , iLineNumber, <u>LF_STRING</u> , szMessage</p>

<p><strong>LE_CLIENT_IN 필드 서식</strong></p>

<p><u>LF_AID</u> , iAccountId, <u>LF_LOGIN_ID</u> , szLoginId</p>

<p><strong>LE_CLIENT_OUT 필드 서식</strong></p>

<p><u>LF_AID</u> , iAccountId, <u>LF_LOGIN_ID</u> , szLoginId</p>

<p><strong>LE_CHAT_CHANNEL 필드 서식</strong></p>

<p><u>LF_AID</u> , iAccountId, <u>LF_LOGIN_ID</u> , szLoginId, <u>LF_CHANNEL_ID</u> , iChannelId, <u>LF_STRING</u> , szMessage</p>

<p><strong>LE_ROOM_CREATE 필드 서식</strong></p>

<p><u>LF_AID</u> , iAccountId, <u>LF_ROOM_ID</u> , iRoomId, <u>LF_STAGE_ID</u> , iStageId, <u>LF_STRING</u> , szMessage</p>

<p><strong>LE_ROOM_JOIN 필드 서식</strong></p>

<p><u>LF_AID</u> , iAccountId, <u>LF_ROOM_ID</u> , iRoomId, <u>LF_STAGE_ID</u> , iStageId, <u>LF_STRING</u> , szMessage</p>

&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;LOG_EVENT_TYPE&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;LF_NONE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_DEBUG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_SUCCESS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_FAIL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_TIME&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_STRING&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_AID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_AID_TARGET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_NAME&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_CHANNEL_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_LOGIN_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_COUNT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_ROOM_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LF_STAGE_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

<p>넷드론 엔진은 다음과 같이 <u>FILELOG</u> 매크로를 제공합니다.</p>

&lt;span class="n"&gt;FILELOG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;LE_ROOM_CREATE&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;LF_AID&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;rkActor_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetAid&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;LF_ROOM_ID&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;pkRoom&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GetId&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;LF_STAGE_ID&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;pkRoom&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GetStageId&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;LF_STRING&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;pkRoom&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GetName&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

<p><u>FILELOG</u> 매크로는 항상 시작 필드에 기록 시간을 남기게 되고 << 연산자를 <u>,</u> 로 인식합니다.</p>

1452416264,26,7,7,22,3072,23,1,6,enjoy your time
1452416267,26,7,7,22,3072,23,1,6,enjoy your time
1452416272,26,7,7,22,3072,23,1,6,enjoy your time

<p>어떠신가요?</p>

<p>문자열 이벤트, 필드 문자열을 사용할때 보다 매우 작은 크기로 저장됩니다. 온라인 게임 서비스를 운영할 때는 매일같이 상당한 양의 로그를 기록합니다. 즉 디스크 용량 한계, 디스크 IO 속도, 로그 데이터 크기, 로그 기록 위치 등을 고려해야 하며 이를 소홀히 할 경우 심각한 상황들을 초래합니다.</p>

Updated by Master Chief about 2 months ago · 4 revisions