Replaced uses of std::cout with Log::Write and Log::Error

This commit is contained in:
parax0 2016-03-21 15:29:56 -06:00
parent 2c120e0b16
commit 0faa4c3630
7 changed files with 17 additions and 19 deletions

View File

@ -1,5 +1,5 @@
#include "CFramebuffer.h"
#include <iostream>
#include <Common/Log.h>
CFramebuffer::CFramebuffer()
{
@ -58,7 +58,7 @@ void CFramebuffer::Init()
mStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (mStatus != GL_FRAMEBUFFER_COMPLETE)
std::cout << "\rError: Framebuffer not complete\n";
Log::Error("Framebuffer not complete");
mInitialized = true;
}

View File

@ -1,11 +1,11 @@
#include "CShader.h"
#include "Core/Render/CGraphics.h"
#include <Common/Log.h>
#include <Common/TString.h>
#include <Common/types.h>
#include <FileIO/CTextInStream.h>
#include <fstream>
#include <iostream>
#include <sstream>
bool gDebugDumpShaders = false;
@ -54,7 +54,7 @@ bool CShader::CompileVertexSource(const char* kpSource)
if (CompileStatus == GL_FALSE)
{
TString Out = "dump/BadVS_" + std::to_string(gFailedCompileCount) + ".txt";
std::cout << "ERROR: Unable to compile vertex shader; dumped to " << Out << "\n";
Log::Error("Unable to compile vertex shader; dumped to " + Out);
DumpShaderSource(mVertexShader, Out);
gFailedCompileCount++;
@ -66,7 +66,7 @@ bool CShader::CompileVertexSource(const char* kpSource)
else if (gDebugDumpShaders == true)
{
TString Out = "dump/VS_" + TString::FromInt64(gSuccessfulCompileCount, 8, 10) + ".txt";
std::cout << "Debug shader dumping enabled; dumped to " << Out << "\n";
Log::Write("Debug shader dumping enabled; dumped to " + Out);
DumpShaderSource(mVertexShader, Out);
gSuccessfulCompileCount++;
@ -89,7 +89,7 @@ bool CShader::CompilePixelSource(const char* kpSource)
if (CompileStatus == GL_FALSE)
{
TString Out = "dump/BadPS_" + TString::FromInt64(gFailedCompileCount, 8, 10) + ".txt";
std::cout << "ERROR: Unable to compile pixel shader; dumped to " << Out << "\n";
Log::Error("Unable to compile pixel shader; dumped to " + Out);
DumpShaderSource(mPixelShader, Out);
gFailedCompileCount++;
@ -101,7 +101,7 @@ bool CShader::CompilePixelSource(const char* kpSource)
else if (gDebugDumpShaders == true)
{
TString Out = "dump/PS_" + TString::FromInt64(gSuccessfulCompileCount, 8, 10) + ".txt";
std::cout << "Debug shader dumping enabled; dumped to " << Out << "\n";
Log::Write("Debug shader dumping enabled; dumped to " + Out);
DumpShaderSource(mPixelShader, Out);
gSuccessfulCompileCount++;
@ -132,7 +132,7 @@ bool CShader::LinkShaders()
if (LinkStatus == GL_FALSE)
{
TString Out = "dump/BadLink_" + TString::FromInt64(gFailedCompileCount, 8, 10) + ".txt";
std::cout << "ERROR: Unable to link shaders. Dumped error log to " << Out << "\n";
Log::Error("Unable to link shaders. Dumped error log to " + Out);
GLint LogLen;
glGetProgramiv(mProgram, GL_INFO_LOG_LENGTH, &LogLen);
@ -205,9 +205,9 @@ CShader* CShader::FromResourceFile(const TString& ShaderName)
CTextInStream PixelShaderFile(PixelShaderFilename.ToStdString());
if (!VertexShaderFile.IsValid())
std::cout << "Error: Couldn't load vertex shader file for " << ShaderName << "\n";
Log::Error("Couldn't load vertex shader file for " + ShaderName);
if (!PixelShaderFile.IsValid())
std::cout << "Error: Couldn't load pixel shader file for " << ShaderName << "\n";
Log::Error("Error: Couldn't load pixel shader file for " + ShaderName);
if ((!VertexShaderFile.IsValid()) || (!PixelShaderFile.IsValid())) return nullptr;
std::stringstream VertexShader;

View File

@ -1,4 +1,5 @@
#include "CPakFile.h"
#include <Common/Log.h>
#include <Common/types.h>
#include <FileIO/CMemoryInStream.h>
#include <FileIO/FileIO.h>
@ -97,7 +98,6 @@ std::vector<u8>* CPakFile::getResource(SResInfo& info)
bool dcmp = decompress(cmp_buf.data(), cmp_buf.size(), res_buf->data(), res_buf->size());
if (!dcmp) {
std::cout << "Error: Unable to decompress " << info.resType.ToString() << " 0x" << std::hex << std::setw(8) << std::setfill('0') << info.resID << std::dec << "\n";
delete res_buf;
return nullptr;
}
@ -136,7 +136,7 @@ bool CPakFile::decompress(u8 *src, u32 src_len, u8 *dst, u32 dst_len)
}
if ((ret != Z_OK) && (ret != Z_STREAM_END)) {
std::cout << "zlib error: " << std::dec << ret << "\n";
Log::Error("zlib error: " + TString::FromInt32(ret, 0, 10));
return false;
}
@ -164,7 +164,7 @@ bool CPakFile::decompress(u8 *src, u32 src_len, u8 *dst, u32 dst_len)
}
if (ret != LZO_E_OK) {
std::cout << "LZO error: " << std::dec << ret << "\n";
Log::Error("LZO error: " + TString::FromInt32(ret, 0, 10));
return false;
}

View File

@ -1,5 +1,5 @@
#include "CTextureEncoder.h"
#include <iostream>
#include <Common/Log.h>
CTextureEncoder::CTextureEncoder()
{
@ -62,7 +62,7 @@ void CTextureEncoder::EncodeTXTR(IOutputStream& TXTR, CTexture *pTex)
{
if (pTex->mTexelFormat != eDXT1)
{
std::cout << "\rError: Unsupported texel format for decoding\n";
Log::Error("Unsupported texel format for decoding");
return;
}

View File

@ -138,7 +138,7 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& MLVL)
}
u32 NumCoordinates = MLVL.ReadLong();
if (NumCoordinates != 4) std::cout << "\rError: Dock coordinate count not 4\n";
if (NumCoordinates != 4) Log::Error("Dock coordinate count not 4");
for (u32 iCoord = 0; iCoord < NumCoordinates; iCoord++)
pDock->DockCoordinates[iCoord] = CVector3f(MLVL);

View File

@ -277,6 +277,6 @@ void CStructTemplate::DebugPrintProperties(TString base)
tmp2->DebugPrintProperties(base);
}
else
std::cout << base << tmp->Name() << "\n";
Log::Write(base + tmp->Name());
}
}

View File

@ -18,8 +18,6 @@ void QtLogRedirect(QtMsgType Type, const QMessageLogContext& /*rkContext*/, cons
case QtCriticalMsg: Log::Write(TString("Qt Critical: ") + TO_TSTRING(rkMessage)); break;
case QtFatalMsg: Log::Write(TString("Qt Fatal: ") + TO_TSTRING(rkMessage)); break;
}
std::cout << TO_TSTRING(rkMessage) << "\n";
}
int main(int argc, char *argv[])