From 907a804409f78a88fadb077664e4d08245099b7d Mon Sep 17 00:00:00 2001 From: Jordan Cristiano Date: Fri, 15 May 2015 00:23:17 -0400 Subject: [PATCH] Added file and clog output for ConLogWriter --- demboyz/conlogwriter.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/demboyz/conlogwriter.cpp b/demboyz/conlogwriter.cpp index 2dbbc6b..e675ab4 100644 --- a/demboyz/conlogwriter.cpp +++ b/demboyz/conlogwriter.cpp @@ -3,6 +3,7 @@ #include "idemowriter.h" #include "netmessages/nethandlers.h" +#include "demotypes.h" #include #include @@ -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(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; }