*Add new log level "crash alarm" to record very dangerous errors.
--HG-- branch : trunk
This commit is contained in:
@@ -515,7 +515,7 @@ void MotionMaster::DirectDelete(_Ty curr)
|
||||
|
||||
void MotionMaster::DelayedDelete(_Ty curr)
|
||||
{
|
||||
sLog.outError("CRASH ALARM! Unit (Entry %u) is trying to delete its updating MG (Type %u)!", i_owner->GetEntry(), curr->GetMovementGeneratorType());
|
||||
sLog.outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", i_owner->GetEntry(), curr->GetMovementGeneratorType());
|
||||
if(isStatic(curr))
|
||||
return;
|
||||
if(!m_expList)
|
||||
|
||||
@@ -402,6 +402,46 @@ void Log::outString( const char * str, ... )
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void Log::outCrash( const char * err, ... )
|
||||
{
|
||||
if( !err )
|
||||
return;
|
||||
|
||||
if (m_enableLogDB)
|
||||
{
|
||||
va_list ap2;
|
||||
va_start(ap2, err);
|
||||
char nnew_str[MAX_QUERY_LEN];
|
||||
vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2);
|
||||
outDB(LOG_TYPE_CRASH, nnew_str);
|
||||
va_end(ap2);
|
||||
}
|
||||
|
||||
if(m_colored)
|
||||
SetColor(false,RED);
|
||||
|
||||
UTF8PRINTF(stderr,err,);
|
||||
|
||||
if(m_colored)
|
||||
ResetColor(false);
|
||||
|
||||
fprintf( stderr, "\n" );
|
||||
if(logfile)
|
||||
{
|
||||
outTimestamp(logfile);
|
||||
fprintf(logfile, "CRASH ALARM:" );
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, err);
|
||||
vfprintf(logfile, err, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(logfile, "\n" );
|
||||
fflush(logfile);
|
||||
}
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
void Log::outError( const char * err, ... )
|
||||
{
|
||||
if( !err )
|
||||
|
||||
@@ -47,6 +47,7 @@ enum LogTypes
|
||||
LOG_TYPE_RA = 7,
|
||||
LOG_TYPE_GM = 8,
|
||||
LOG_TYPE_PACKET = 9,
|
||||
LOG_TYPE_CRASH = 10,
|
||||
MAX_LOG_TYPES
|
||||
};
|
||||
|
||||
@@ -97,6 +98,7 @@ class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ZThr
|
||||
void outDB( uint8 type, const char * str, ... ) ATTR_PRINTF(3,4);
|
||||
void outString( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||
void outError( const char * err, ... ) ATTR_PRINTF(2,3);
|
||||
void outCrash( const char * err, ... ) ATTR_PRINTF(2,3);
|
||||
void outBasic( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||
void outDetail( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||
void outDebug( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||
|
||||
Reference in New Issue
Block a user