change logger

This commit is contained in:
Eduardo Bart
2012-06-01 17:39:23 -03:00
parent bd2faabe99
commit 14db1066fc
48 changed files with 237 additions and 287 deletions

View File

@@ -118,7 +118,7 @@ bool ResourceManager::saveFile(const std::string& fileName, const uchar* data, u
PHYSFS_file* file = PHYSFS_openWrite(fileName.c_str());
if(!file)
{
logError(PHYSFS_getLastError());
g_logger.error(PHYSFS_getLastError());
return false;
}
@@ -150,7 +150,7 @@ FileStreamPtr ResourceManager::openFile(const std::string& fileName)
std::string fullPath = resolvePath(fileName);
PHYSFS_File* file = PHYSFS_openRead(fullPath.c_str());
if(!file) {
logTraceError("unable to open file '%s': %s", fullPath, PHYSFS_getLastError());
g_logger.error(stdext::format("unable to open file '%s': %s", fullPath, PHYSFS_getLastError()));
return nullptr;
}
return FileStreamPtr(new FileStream(fullPath, file));
@@ -160,7 +160,7 @@ FileStreamPtr ResourceManager::appendFile(const std::string& fileName)
{
PHYSFS_File* file = PHYSFS_openAppend(fileName.c_str());
if(!file) {
logTraceError("failed to append file '%s': %s", fileName, PHYSFS_getLastError());
g_logger.error(stdext::format("failed to append file '%s': %s", fileName, PHYSFS_getLastError()));
return nullptr;
}
return FileStreamPtr(new FileStream(fileName, file));
@@ -170,7 +170,7 @@ FileStreamPtr ResourceManager::createFile(const std::string& fileName)
{
PHYSFS_File* file = PHYSFS_openWrite(fileName.c_str());
if(!file) {
logTraceError("failed to create file '%s': %s", fileName, PHYSFS_getLastError());
g_logger.error(stdext::format("failed to create file '%s': %s", fileName, PHYSFS_getLastError()));
return nullptr;
}
return FileStreamPtr(new FileStream(fileName, file));
@@ -211,7 +211,7 @@ std::string ResourceManager::resolvePath(const std::string& path)
fullPath += path;
}
if(!(boost::starts_with(fullPath, "/")))
logTraceWarning("the following file path is not fully resolved: %s", path);
g_logger.traceWarning(stdext::format("the following file path is not fully resolved: %s", path));
boost::replace_all(fullPath, "//", "/");
return fullPath;
}