mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[8797] Merge WorldLog class into Log class.
* Added AuthSocket::SendPacket() function. * Packet logging now also possible in realmd. * realmd.conf.dist.in updated (added "WorldLogFile" setting).
This commit is contained in:
parent
fc42125cfb
commit
07aa44992b
13 changed files with 117 additions and 183 deletions
|
|
@ -283,8 +283,6 @@ libmangosgame_a_SOURCES = \
|
||||||
Weather.h \
|
Weather.h \
|
||||||
World.cpp \
|
World.cpp \
|
||||||
World.h \
|
World.h \
|
||||||
WorldLog.cpp \
|
|
||||||
WorldLog.h \
|
|
||||||
WorldSession.cpp \
|
WorldSession.cpp \
|
||||||
WorldSession.h \
|
WorldSession.h \
|
||||||
WorldSocket.cpp \
|
WorldSocket.cpp \
|
||||||
|
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** \file
|
|
||||||
\ingroup u2w
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "WorldLog.h"
|
|
||||||
#include "Policies/SingletonImp.h"
|
|
||||||
#include "Config/ConfigEnv.h"
|
|
||||||
|
|
||||||
#define CLASS_LOCK MaNGOS::ClassLevelLockable<WorldLog, ACE_Thread_Mutex>
|
|
||||||
INSTANTIATE_SINGLETON_2(WorldLog, CLASS_LOCK);
|
|
||||||
INSTANTIATE_CLASS_MUTEX(WorldLog, ACE_Thread_Mutex);
|
|
||||||
|
|
||||||
/// Open the log file (if specified so in the configuration file)
|
|
||||||
void WorldLog::Initialize()
|
|
||||||
{
|
|
||||||
std::string logsDir = sConfig.GetStringDefault("LogsDir","");
|
|
||||||
|
|
||||||
if(!logsDir.empty())
|
|
||||||
{
|
|
||||||
if((logsDir.at(logsDir.length()-1)!='/') && (logsDir.at(logsDir.length()-1)!='\\'))
|
|
||||||
logsDir.append("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string logname = sConfig.GetStringDefault("WorldLogFile", "");
|
|
||||||
if(!logname.empty())
|
|
||||||
{
|
|
||||||
i_file = fopen((logsDir+logname).c_str(), "w");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// \addtogroup u2w
|
|
||||||
/// @{
|
|
||||||
/// \file
|
|
||||||
|
|
||||||
#ifndef MANGOS_WORLDLOG_H
|
|
||||||
#define MANGOS_WORLDLOG_H
|
|
||||||
|
|
||||||
#include "Common.h"
|
|
||||||
#include "Policies/Singleton.h"
|
|
||||||
#include "Errors.h"
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
/// %Log packets to a file
|
|
||||||
class MANGOS_DLL_DECL WorldLog : public MaNGOS::Singleton<WorldLog, MaNGOS::ClassLevelLockable<WorldLog, ACE_Thread_Mutex> >
|
|
||||||
{
|
|
||||||
friend class MaNGOS::OperatorNew<WorldLog>;
|
|
||||||
WorldLog() : i_file(NULL) { Initialize(); }
|
|
||||||
WorldLog(const WorldLog &);
|
|
||||||
WorldLog& operator=(const WorldLog &);
|
|
||||||
typedef MaNGOS::ClassLevelLockable<WorldLog, ACE_Thread_Mutex>::Lock Guard;
|
|
||||||
|
|
||||||
/// Close the file in destructor
|
|
||||||
~WorldLog()
|
|
||||||
{
|
|
||||||
if( i_file != NULL )
|
|
||||||
fclose(i_file);
|
|
||||||
i_file = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
void Initialize();
|
|
||||||
/// Is the world logger active?
|
|
||||||
bool LogWorld(void) const { return (i_file != NULL); }
|
|
||||||
/// %Log to the file
|
|
||||||
void Log(char const *fmt, ...)
|
|
||||||
{
|
|
||||||
if( LogWorld() )
|
|
||||||
{
|
|
||||||
Guard guard(*this);
|
|
||||||
ASSERT(i_file);
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
vfprintf(i_file, fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
fflush(i_file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
FILE *i_file;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define sWorldLog WorldLog::Instance()
|
|
||||||
#endif
|
|
||||||
/// @}
|
|
||||||
|
|
@ -42,7 +42,6 @@
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include "WorldSocketMgr.h"
|
#include "WorldSocketMgr.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "WorldLog.h"
|
|
||||||
|
|
||||||
#if defined( __GNUC__ )
|
#if defined( __GNUC__ )
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
@ -166,24 +165,21 @@ int WorldSocket::SendPacket (const WorldPacket& pct)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Dump outgoing packet.
|
// Dump outgoing packet.
|
||||||
if (sWorldLog.LogWorld ())
|
if (sLog.IsLogWorld())
|
||||||
{
|
{
|
||||||
sWorldLog.Log ("SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
sLog.outWorld("S->C - SOCKET: %u LENGTH: %u OPCODE: %s (0x%.4X)\n",
|
||||||
(uint32) get_handle (),
|
uint32(get_handle()), pct.size (), LookupOpcodeName(pct.GetOpcode()), pct.GetOpcode());
|
||||||
pct.size (),
|
|
||||||
LookupOpcodeName (pct.GetOpcode ()),
|
|
||||||
pct.GetOpcode ());
|
|
||||||
|
|
||||||
uint32 p = 0;
|
size_t p = 0;
|
||||||
while (p < pct.size ())
|
while (p < pct.size())
|
||||||
{
|
{
|
||||||
for (uint32 j = 0; j < 16 && p < pct.size (); j++)
|
for (size_t j = 0; j < 16 && p < pct.size(); ++j)
|
||||||
sWorldLog.Log ("%.2X ", const_cast<WorldPacket&>(pct)[p++]);
|
sLog.outWorld("%.2X ", const_cast<WorldPacket&>(pct)[p++]);
|
||||||
|
|
||||||
sWorldLog.Log ("\n");
|
sLog.outWorld("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
sWorldLog.Log ("\n\n");
|
sLog.outWorld("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerPktHeader header(pct.size()+2, pct.GetOpcode());
|
ServerPktHeader header(pct.size()+2, pct.GetOpcode());
|
||||||
|
|
@ -682,25 +678,25 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Dump received packet.
|
// Dump received packet.
|
||||||
if (sWorldLog.LogWorld ())
|
if (sLog.IsLogWorld())
|
||||||
{
|
{
|
||||||
sWorldLog.Log ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
sLog.outWorld("C->S - SOCKET: %u LENGTH: %u OPCODE: %s (0x%.4X)\n",
|
||||||
(uint32) get_handle (),
|
uint32(get_handle()), new_pct->size(), LookupOpcodeName(new_pct->GetOpcode()), new_pct->GetOpcode());
|
||||||
new_pct->size (),
|
|
||||||
LookupOpcodeName (new_pct->GetOpcode ()),
|
|
||||||
new_pct->GetOpcode ());
|
|
||||||
|
|
||||||
uint32 p = 0;
|
size_t p = 0;
|
||||||
while (p < new_pct->size ())
|
while (p < new_pct->size())
|
||||||
{
|
{
|
||||||
for (uint32 j = 0; j < 16 && p < new_pct->size (); j++)
|
for (size_t j = 0; j < 16 && p < new_pct->size(); ++j)
|
||||||
sWorldLog.Log ("%.2X ", (*new_pct)[p++]);
|
sLog.outWorld("%.2X ", (*new_pct)[p++]);
|
||||||
sWorldLog.Log ("\n");
|
|
||||||
|
sLog.outWorld("\n");
|
||||||
}
|
}
|
||||||
sWorldLog.Log ("\n\n");
|
|
||||||
|
sLog.outWorld("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
switch(opcode)
|
switch(opcode)
|
||||||
{
|
{
|
||||||
case CMSG_PING:
|
case CMSG_PING:
|
||||||
|
|
@ -738,13 +734,13 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(ByteBufferException &)
|
catch (ByteBufferException &)
|
||||||
{
|
{
|
||||||
sLog.outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
|
sLog.outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
|
||||||
opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1);
|
opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1);
|
||||||
if(sLog.IsOutDebug())
|
if(sLog.IsOutDebug())
|
||||||
{
|
{
|
||||||
sLog.outDebug("Dumping error causing packet:");
|
sLog.outDebug("Dumping error-causing packet:");
|
||||||
new_pct->hexlike();
|
new_pct->hexlike();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
#include "ByteBuffer.h"
|
|
||||||
#include "Config/ConfigEnv.h"
|
#include "Config/ConfigEnv.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "RealmList.h"
|
#include "RealmList.h"
|
||||||
|
|
@ -252,14 +251,37 @@ void AuthSocket::OnRead()
|
||||||
///- Read the packet
|
///- Read the packet
|
||||||
TcpSocket::OnRead();
|
TcpSocket::OnRead();
|
||||||
uint8 _cmd;
|
uint8 _cmd;
|
||||||
while (1)
|
while (true)
|
||||||
{
|
{
|
||||||
if (!ibuf.GetLength())
|
if (!ibuf.GetLength())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
///- Get the command out of it
|
///- Get the command out of it. We can assume it's there, since length is not 0.
|
||||||
ibuf.SoftRead((char *)&_cmd, 1); // UQ1: No longer exists in new net code ???
|
ibuf.SoftRead((char *)&_cmd, 1); // UQ1: No longer exists in new net code ???
|
||||||
|
|
||||||
|
// Dump incoming packet.
|
||||||
|
if (sLog.IsLogWorld())
|
||||||
|
{
|
||||||
|
sLog.outWorld ("C->S - SOCKET: %u LENGTH: %u OPCODE: 0x%.4X\n",
|
||||||
|
GetSocket(), ibuf.GetLength(), _cmd);
|
||||||
|
|
||||||
|
size_t p = 0;
|
||||||
|
while (p < ibuf.GetLength())
|
||||||
|
{
|
||||||
|
char dest;
|
||||||
|
for (size_t j = 0; j < 16 && p < ibuf.GetLength(); ++j)
|
||||||
|
{
|
||||||
|
ibuf.SoftRead(&dest, 1);
|
||||||
|
sLog.outWorld("%.2X ", *((uint8*)dest));
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
sLog.outWorld("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
sLog.outWorld("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
///- Circle through known commands and call the correct command handler
|
///- Circle through known commands and call the correct command handler
|
||||||
|
|
@ -289,7 +311,34 @@ void AuthSocket::OnRead()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Make the SRP6 calculation from hash in dB
|
void AuthSocket::SendPacket(ByteBuffer* buf)
|
||||||
|
{
|
||||||
|
// TODO: Also handle outgoing structs?
|
||||||
|
|
||||||
|
uint8 _cmd = buf->read<uint8>();
|
||||||
|
|
||||||
|
// Dump outgoing packet.
|
||||||
|
if (sLog.IsLogWorld())
|
||||||
|
{
|
||||||
|
sLog.outWorld ("S->C - SOCKET: %u LENGTH: %u OPCODE: 0x%.4X\n",
|
||||||
|
GetSocket(), buf->size(), _cmd);
|
||||||
|
|
||||||
|
size_t p = 0;
|
||||||
|
while (p < buf->size())
|
||||||
|
{
|
||||||
|
for (size_t j = 0; j < 16 && p < buf->size(); ++j)
|
||||||
|
sLog.outWorld("%.2X ", (*buf)[p++]);
|
||||||
|
|
||||||
|
sLog.outWorld("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
sLog.outWorld("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
SendBuf((char const*)buf->contents(), buf->size());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Make the SRP6 calculation from hash in DB
|
||||||
void AuthSocket::_SetVSFields(const std::string& rI)
|
void AuthSocket::_SetVSFields(const std::string& rI)
|
||||||
{
|
{
|
||||||
s.SetRand(s_BYTE_SIZE * 8);
|
s.SetRand(s_BYTE_SIZE * 8);
|
||||||
|
|
@ -521,7 +570,8 @@ bool AuthSocket::_HandleLogonChallenge()
|
||||||
pkt<< (uint8) REALM_AUTH_NO_MATCH;
|
pkt<< (uint8) REALM_AUTH_NO_MATCH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SendBuf((char const*)pkt.contents(), pkt.size());
|
|
||||||
|
SendPacket(&pkt);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -567,7 +617,7 @@ bool AuthSocket::_HandleLogonProof()
|
||||||
pkt << (uint8) REALM_AUTH_WRONG_BUILD_NUMBER;
|
pkt << (uint8) REALM_AUTH_WRONG_BUILD_NUMBER;
|
||||||
DEBUG_LOG("[AuthChallenge] %u is not a valid client version!", _build);
|
DEBUG_LOG("[AuthChallenge] %u is not a valid client version!", _build);
|
||||||
DEBUG_LOG("[AuthChallenge] Patch %s not found", tmp);
|
DEBUG_LOG("[AuthChallenge] Patch %s not found", tmp);
|
||||||
SendBuf((char const*)pkt.contents(), pkt.size());
|
SendPacket(&pkt);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else // have patch
|
else // have patch
|
||||||
|
|
@ -807,7 +857,7 @@ bool AuthSocket::_HandleReconnectChallenge()
|
||||||
_reconnectProof.SetRand(16 * 8);
|
_reconnectProof.SetRand(16 * 8);
|
||||||
pkt.append(_reconnectProof.AsByteArray(16),16); // 16 bytes random
|
pkt.append(_reconnectProof.AsByteArray(16),16); // 16 bytes random
|
||||||
pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros
|
pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros
|
||||||
SendBuf((char const*)pkt.contents(), pkt.size());
|
SendPacket(&pkt);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -839,7 +889,7 @@ bool AuthSocket::_HandleReconnectProof()
|
||||||
pkt << (uint8) AUTH_RECONNECT_PROOF;
|
pkt << (uint8) AUTH_RECONNECT_PROOF;
|
||||||
pkt << (uint8) 0x00;
|
pkt << (uint8) 0x00;
|
||||||
pkt << (uint16) 0x00; // 2 bytes zeros
|
pkt << (uint16) 0x00; // 2 bytes zeros
|
||||||
SendBuf((char const*)pkt.contents(), pkt.size());
|
SendPacket(&pkt);
|
||||||
|
|
||||||
///- Set _authed to true!
|
///- Set _authed to true!
|
||||||
_authed = true;
|
_authed = true;
|
||||||
|
|
@ -921,7 +971,7 @@ bool AuthSocket::_HandleRealmList()
|
||||||
hdr << (uint16)pkt.size();
|
hdr << (uint16)pkt.size();
|
||||||
hdr.append(pkt);
|
hdr.append(pkt);
|
||||||
|
|
||||||
SendBuf((char const*)hdr.contents(), hdr.size());
|
SendPacket(&pkt);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#define _AUTHSOCKET_H
|
#define _AUTHSOCKET_H
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "ByteBuffer.h"
|
||||||
#include "Auth/BigNumber.h"
|
#include "Auth/BigNumber.h"
|
||||||
#include "sockets/TcpSocket.h"
|
#include "sockets/TcpSocket.h"
|
||||||
#include "sockets/SocketHandler.h"
|
#include "sockets/SocketHandler.h"
|
||||||
|
|
@ -55,6 +56,8 @@ class AuthSocket: public TcpSocket
|
||||||
bool _HandleXferCancel();
|
bool _HandleXferCancel();
|
||||||
bool _HandleXferAccept();
|
bool _HandleXferAccept();
|
||||||
|
|
||||||
|
void SendPacket(ByteBuffer* buf);
|
||||||
|
|
||||||
void _SetVSFields(const std::string& rI);
|
void _SetVSFields(const std::string& rI);
|
||||||
|
|
||||||
FILE *pPatch;
|
FILE *pPatch;
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,10 @@ ConfVersion=2007062001
|
||||||
# Default: "Realmd.log"
|
# Default: "Realmd.log"
|
||||||
# "" - empty name disable creating log file
|
# "" - empty name disable creating log file
|
||||||
#
|
#
|
||||||
|
# WorldLogFile
|
||||||
|
# Packet logging file for the realmserver
|
||||||
|
# Default: "world.log"
|
||||||
|
#
|
||||||
# LogTimestamp
|
# LogTimestamp
|
||||||
# Logfile with timestamp of server start in name
|
# Logfile with timestamp of server start in name
|
||||||
# Default: 0 - no timestamp in name
|
# Default: 0 - no timestamp in name
|
||||||
|
|
@ -105,6 +109,7 @@ PidFile = ""
|
||||||
LogLevel = 0
|
LogLevel = 0
|
||||||
LogTime = 0
|
LogTime = 0
|
||||||
LogFile = "Realmd.log"
|
LogFile = "Realmd.log"
|
||||||
|
WorldLogFile = ""
|
||||||
LogTimestamp = 0
|
LogTimestamp = 0
|
||||||
LogFileLevel = 0
|
LogFileLevel = 0
|
||||||
LogColors = ""
|
LogColors = ""
|
||||||
|
|
|
||||||
|
|
@ -225,9 +225,9 @@ void Log::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a");
|
charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a");
|
||||||
|
|
||||||
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
|
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
|
||||||
raLogfile = openLogFile("RaLogFile",NULL,"a");
|
raLogfile = openLogFile("RaLogFile",NULL,"a");
|
||||||
|
worldLogfile = openLogFile("WorldLogFile",NULL,"a");
|
||||||
|
|
||||||
// Main log file settings
|
// Main log file settings
|
||||||
m_includeTime = sConfig.GetBoolDefault("LogTime", false);
|
m_includeTime = sConfig.GetBoolDefault("LogTime", false);
|
||||||
|
|
@ -698,6 +698,21 @@ void Log::outChar(const char * str, ... )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Log::outWorld( const char * str, ... )
|
||||||
|
{
|
||||||
|
if (!str)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (worldLogfile)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, str);
|
||||||
|
vfprintf(worldLogfile, str, args);
|
||||||
|
va_end(args);
|
||||||
|
fflush(worldLogfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Log::outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name )
|
void Log::outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name )
|
||||||
{
|
{
|
||||||
if(charLogfile)
|
if(charLogfile)
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,10 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
||||||
if (raLogfile != NULL)
|
if (raLogfile != NULL)
|
||||||
fclose(raLogfile);
|
fclose(raLogfile);
|
||||||
raLogfile = NULL;
|
raLogfile = NULL;
|
||||||
|
|
||||||
|
if (worldLogfile != NULL)
|
||||||
|
fclose(worldLogfile);
|
||||||
|
worldLogfile = NULL;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
@ -106,6 +110,8 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
||||||
// any log level
|
// any log level
|
||||||
void outChar( const char * str, ... ) ATTR_PRINTF(2,3);
|
void outChar( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||||
// any log level
|
// any log level
|
||||||
|
void outWorld( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||||
|
// any log level
|
||||||
void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name );
|
void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name );
|
||||||
void outRALog( const char * str, ... ) ATTR_PRINTF(2,3);
|
void outRALog( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||||
void SetLogLevel(char * Level);
|
void SetLogLevel(char * Level);
|
||||||
|
|
@ -118,6 +124,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
||||||
uint32 getLogFilter() const { return m_logFilter; }
|
uint32 getLogFilter() const { return m_logFilter; }
|
||||||
bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
|
bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
|
||||||
bool IsOutCharDump() const { return m_charLog_Dump; }
|
bool IsOutCharDump() const { return m_charLog_Dump; }
|
||||||
|
bool IsLogWorld() const { return (worldLogfile); }
|
||||||
bool IsIncludeTime() const { return m_includeTime; }
|
bool IsIncludeTime() const { return m_includeTime; }
|
||||||
private:
|
private:
|
||||||
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
|
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
|
||||||
|
|
@ -128,6 +135,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
||||||
FILE* gmLogfile;
|
FILE* gmLogfile;
|
||||||
FILE* charLogfile;
|
FILE* charLogfile;
|
||||||
FILE* dberLogfile;
|
FILE* dberLogfile;
|
||||||
|
FILE* worldLogfile;
|
||||||
|
|
||||||
// log/console control
|
// log/console control
|
||||||
uint32 m_logLevel;
|
uint32 m_logLevel;
|
||||||
|
|
@ -152,7 +160,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
||||||
#define sLog MaNGOS::Singleton<Log>::Instance()
|
#define sLog MaNGOS::Singleton<Log>::Instance()
|
||||||
|
|
||||||
#ifdef MANGOS_DEBUG
|
#ifdef MANGOS_DEBUG
|
||||||
#define DEBUG_LOG MaNGOS::Singleton<Log>::Instance().outDebug
|
#define DEBUG_LOG sLog.outDebug
|
||||||
#else
|
#else
|
||||||
#define DEBUG_LOG
|
#define DEBUG_LOG
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8796"
|
#define REVISION_NR "8797"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,6 @@
|
||||||
<ClCompile Include="..\..\src\game\WaypointMovementGenerator.cpp" />
|
<ClCompile Include="..\..\src\game\WaypointMovementGenerator.cpp" />
|
||||||
<ClCompile Include="..\..\src\game\Weather.cpp" />
|
<ClCompile Include="..\..\src\game\Weather.cpp" />
|
||||||
<ClCompile Include="..\..\src\game\World.cpp" />
|
<ClCompile Include="..\..\src\game\World.cpp" />
|
||||||
<ClCompile Include="..\..\src\game\WorldLog.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\game\WorldSession.cpp" />
|
<ClCompile Include="..\..\src\game\WorldSession.cpp" />
|
||||||
<ClCompile Include="..\..\src\game\WorldSocket.cpp" />
|
<ClCompile Include="..\..\src\game\WorldSocket.cpp" />
|
||||||
<ClCompile Include="..\..\src\game\WorldSocketMgr.cpp" />
|
<ClCompile Include="..\..\src\game\WorldSocketMgr.cpp" />
|
||||||
|
|
@ -621,7 +620,6 @@
|
||||||
<ClInclude Include="..\..\src\game\WaypointMovementGenerator.h" />
|
<ClInclude Include="..\..\src\game\WaypointMovementGenerator.h" />
|
||||||
<ClInclude Include="..\..\src\game\Weather.h" />
|
<ClInclude Include="..\..\src\game\Weather.h" />
|
||||||
<ClInclude Include="..\..\src\game\World.h" />
|
<ClInclude Include="..\..\src\game\World.h" />
|
||||||
<ClInclude Include="..\..\src\game\WorldLog.h" />
|
|
||||||
<ClInclude Include="..\..\src\game\WorldSession.h" />
|
<ClInclude Include="..\..\src\game\WorldSession.h" />
|
||||||
<ClInclude Include="..\..\src\game\WorldSocket.h" />
|
<ClInclude Include="..\..\src\game\WorldSocket.h" />
|
||||||
<ClInclude Include="..\..\src\game\WorldSocketMgr.h" />
|
<ClInclude Include="..\..\src\game\WorldSocketMgr.h" />
|
||||||
|
|
|
||||||
|
|
@ -1485,14 +1485,6 @@
|
||||||
RelativePath="..\..\src\game\SharedDefines.h"
|
RelativePath="..\..\src\game\SharedDefines.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\game\WorldLog.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\game\WorldLog.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\game\WorldSession.cpp"
|
RelativePath="..\..\src\game\WorldSession.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -1486,14 +1486,6 @@
|
||||||
RelativePath="..\..\src\game\SharedDefines.h"
|
RelativePath="..\..\src\game\SharedDefines.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\game\WorldLog.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\game\WorldLog.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\game\WorldSession.cpp"
|
RelativePath="..\..\src\game\WorldSession.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue