Core/Logging: Move player delete logging to new type LOG_FILTER_PLAYER_DELETE (34). Also add missing sql from 55ce180f28

This commit is contained in:
Spp
2012-08-06 08:49:31 +02:00
parent 1bd8cb9a7c
commit 483fb42306
5 changed files with 16 additions and 12 deletions

View File

@@ -0,0 +1,4 @@
DELETE FROM `command` WHERE `name` IN ('server togglequerylog', 'server set loglevel');
INSERT INTO `command` (`name`,`security`,`help`) VALUES
('server set loglevel',4,'Syntax: .server set loglevel $facility $name $loglevel. $facility can take the values: appender (a) or logger (l). $loglevel can take the values: disabled (0), trace (1), debug (2), info (3), warn (4), error (5) or fatal (6)');

View File

@@ -687,7 +687,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sGuildMgr->GetGuildByLeader(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER);
SendPacket(&data);
return;
}
@@ -696,18 +696,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN;
data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN);
SendPacket(&data);
return;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID);
stmt->setUInt32(0, GUID_LOPART(guid));
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
accountId = fields[0].GetUInt32();
@@ -719,22 +716,21 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
return;
std::string IP_str = GetRemoteAddress();
sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
sScriptMgr->OnPlayerDelete(guid);
sWorld->DeleteCharaceterNameData(GUID_LOPART(guid));
if (sLog->ShouldLog(LOG_FILTER_PLAYER, LOG_LEVEL_TRACE)) // optimize GetPlayerDump call
if (sLog->ShouldLog(LOG_FILTER_PLAYER_DELETE, LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
std::string dump;
if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))
sLog->outTrace(LOG_FILTER_PLAYER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
sLog->outInfo(LOG_FILTER_PLAYER_DELETE, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
}
Player::DeleteFromDB(guid, GetAccountId());
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_SUCCESS;
data << uint8(CHAR_DELETE_SUCCESS);
SendPacket(&data);
}

View File

@@ -201,6 +201,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type)
return "GAMEEVENTS";
case LOG_FILTER_CALENDAR:
return "CALENDAR";
case LOG_FILTER_PLAYER_DELETE:
return "PLAYER_DELETE";
default:
break;
}

View File

@@ -58,10 +58,11 @@ enum LogFilterType
LOG_FILTER_AUTHSERVER,
LOG_FILTER_WORLDSERVER,
LOG_FILTER_GAMEEVENTS,
LOG_FILTER_CALENDAR
LOG_FILTER_CALENDAR,
LOG_FILTER_PLAYER_DELETE
};
const uint8 MaxLogFilter = uint8(LOG_FILTER_CALENDAR) + 1;
const uint8 MaxLogFilter = uint8(LOG_FILTER_PLAYER_DELETE) + 1;
// Values assigned have their equivalent in enum ACE_Log_Priority
enum LogLevel

View File

@@ -2695,6 +2695,7 @@ PlayerDump.DisallowOverwrite = 1
# 31 - Worldserver
# 32 - Game Events
# 33 - Calendar
# 34 - Player delete
#
# Logger.name.Level
# Description: Logger level of logging