Added file and clog output for ConLogWriter

This commit is contained in:
Jordan Cristiano 2015-05-15 00:23:17 -04:00
parent 8c178bf9ac
commit 907a804409

View File

@ -3,6 +3,7 @@
#include "idemowriter.h"
#include "netmessages/nethandlers.h"
#include "demotypes.h"
#include <cstdio>
#include <iostream>
@ -18,6 +19,9 @@ public:
virtual void EndCommandPacket() override final;
virtual void WriteNetPacket(NetPacket& packet) override final;
private:
FILE* m_outputFp;
};
IDemoWriter* IDemoWriter::CreateConLogWriter(void* outputFp)
@ -25,12 +29,17 @@ IDemoWriter* IDemoWriter::CreateConLogWriter(void* outputFp)
return new ConLogWriter(reinterpret_cast<FILE*>(outputFp));
}
ConLogWriter::ConLogWriter(FILE* outputFp)
ConLogWriter::ConLogWriter(FILE* outputFp):
m_outputFp(outputFp)
{
}
void ConLogWriter::StartWriting(demoheader_t& header)
{
//std::ostringstream ss;
//ss << "Playing demo from " << << ".\n";
//fputs(ss.str().c_str(), m_outputFp);
//std::clog << ss.str() << std::endl;
}
void ConLogWriter::EndWriting()
@ -49,5 +58,7 @@ void ConLogWriter::WriteNetPacket(NetPacket& packet)
{
std::ostringstream ss;
NetHandlers::NetMsg_ToString(packet.type, ss, packet.data);
std::cout << ss.str() << std::endl;
ss << "\n";
fputs(ss.str().c_str(), m_outputFp);
std::clog << ss.str() << std::endl;
}