mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-07 19:42:26 +00:00
Remove EQEmuLog::Dump
This commit is contained in:
parent
5161cb6bd2
commit
a4dbe13c3d
@ -270,70 +270,3 @@ bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...)
|
|||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool EQEmuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip)
|
|
||||||
{
|
|
||||||
if (!logFileValid) {
|
|
||||||
logger.LogDebug(EQEmuLogSys::Detail, "Error: Dump() from null pointer");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (size == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!LogFile) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (id >= MaxLogID) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool dofile = false;
|
|
||||||
if (pLogStatus[id] & 1) {
|
|
||||||
dofile = open(id);
|
|
||||||
}
|
|
||||||
if (!(dofile || pLogStatus[id] & 2)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
LockMutex lock(&MLog[id]);
|
|
||||||
if (!logFileValid) {
|
|
||||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
|
||||||
}
|
|
||||||
write(id, "Dumping Packet: %i", size);
|
|
||||||
// Output as HEX
|
|
||||||
int beginningOfLineOffset = 0;
|
|
||||||
uint32 indexInData;
|
|
||||||
std::string asciiOutput;
|
|
||||||
for (indexInData = skip; indexInData < size; indexInData++) {
|
|
||||||
if ((indexInData - skip) % cols == 0) {
|
|
||||||
if (indexInData != skip) {
|
|
||||||
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
|
||||||
}
|
|
||||||
writeNTS(id, dofile, "%4i: ", indexInData - skip);
|
|
||||||
asciiOutput.clear();
|
|
||||||
beginningOfLineOffset = 0;
|
|
||||||
} else if ((indexInData - skip) % (cols / 2) == 0) {
|
|
||||||
writeNTS(id, dofile, "- ");
|
|
||||||
}
|
|
||||||
writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]);
|
|
||||||
if (data[indexInData] >= 32 && data[indexInData] < 127) {
|
|
||||||
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
|
|
||||||
// Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long
|
|
||||||
// version.
|
|
||||||
asciiOutput.append(std::to_string((long long)data[indexInData]));
|
|
||||||
} else {
|
|
||||||
asciiOutput.append(".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uint32 k = ((indexInData - skip) - 1) % cols;
|
|
||||||
if (k < 8) {
|
|
||||||
writeNTS(id, dofile, " ");
|
|
||||||
}
|
|
||||||
for (uint32 h = k + 1; h < cols; h++) {
|
|
||||||
writeNTS(id, dofile, " ");
|
|
||||||
}
|
|
||||||
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
|
||||||
if (dofile) {
|
|
||||||
fflush(fp[id]);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,6 @@ public:
|
|||||||
|
|
||||||
bool write(LogIDs id, const char *fmt, ...);
|
bool write(LogIDs id, const char *fmt, ...);
|
||||||
bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args);
|
bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args);
|
||||||
bool Dump(LogIDs id, uint8* data, uint32 size, uint32 cols=16, uint32 skip=0);
|
|
||||||
private:
|
private:
|
||||||
bool open(LogIDs id);
|
bool open(LogIDs id);
|
||||||
bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline
|
bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user