Improved Error system

Former-commit-id: ddd08841d30575713f4a28ac02566f92791e5539
This commit is contained in:
Lynix
2013-09-25 09:29:25 +02:00
parent 672cbaed1d
commit a410e8856a
16 changed files with 199 additions and 51 deletions

View File

@@ -136,21 +136,17 @@ void NzLog::Write(const NzString& string)
}
}
void NzLog::WriteError(nzErrorType type, const NzString& error)
{
NzStringStream stream;
stream << errorType[type] << error;
Write(stream);
}
void NzLog::WriteError(nzErrorType type, const NzString& error, unsigned int line, const NzString& file, const NzString& func)
{
NzString stream;
stream.Reserve(std::strlen(errorType[type]) + error.GetSize() + 2 + file.GetSize() + 1 + NzGetNumberLength(line) +2 + func.GetSize() + 1);
stream += errorType[type];
stream += error;
stream += " (";
stream += file;
stream += ':';
stream += NzString::Number(line);
stream += ": ";
stream += func;
stream += ')';
/*NzStringStream stream;
stream << errorType[type] << error << " (" << file << ':' << line << ": " << func << ')';*/
NzStringStream stream;
stream << errorType[type] << error << " (" << file << ':' << line << ": " << func << ')';
Write(stream);
}