new logger

scripts are now more error prone
This commit is contained in:
Eduardo Bart
2011-04-22 15:48:02 -03:00
parent e611734396
commit 96e0b1e909
30 changed files with 181 additions and 178 deletions

View File

@@ -68,7 +68,7 @@ bool Font::load(const std::string& file)
{
std::string fileContents = g_resources.loadTextFile(file);
if(!fileContents.size()) {
logError("Coult not load font file \"%s", file.c_str());
flogError("ERROR: Coult not load font file \"%s", file.c_str());
return false;
}
@@ -96,7 +96,7 @@ bool Font::load(const std::string& file)
// load texture
m_texture = g_textures.get("fonts/" + textureName);
if(!m_texture) {
logError("Failed to load image for font file \"%s\"", file.c_str());
flogError("ERROR: Failed to load image for font file \"%s\"", file.c_str());
return false;
}
@@ -123,7 +123,7 @@ bool Font::load(const std::string& file)
m_glyphHeight);
}
} catch (YAML::Exception& e) {
logError("Malformed font file \"%s\":\n %s", file.c_str(), e.what());
flogError("ERROR: Malformed font file \"%s\":\n %s", file.c_str() % e.what());
return false;
}

View File

@@ -47,7 +47,7 @@ void Fonts::init(const std::string& defaultFontName)
}
if(!m_defaultFont)
logFatal("Could not load the default font \"%s\"\n", defaultFontName.c_str());
flogFatal("FATAL ERROR: Could not load the default font \"%s\"\n", defaultFontName.c_str());
}
Font* Fonts::get(const std::string& fontName)
@@ -58,6 +58,6 @@ Font* Fonts::get(const std::string& fontName)
return (*it).get();
}
logError("Font \"%s\" not found, returing the default one", fontName.c_str());
flogError("ERROR: Font \"%s\" not found, returing the default one", fontName.c_str());
return m_defaultFont.get();
}

View File

@@ -43,8 +43,8 @@ void Graphics::init()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
logInfo("GPU %s", (const char*)glGetString(GL_RENDERER));
logInfo("OpenGL %s", (const char*)glGetString(GL_VERSION));
flogInfo("GPU %s", (const char*)glGetString(GL_RENDERER));
flogInfo("OpenGL %s", (const char*)glGetString(GL_VERSION));
}
void Graphics::terminate()

View File

@@ -46,18 +46,18 @@ TexturePtr Textures::get(const std::string& textureFile)
if(!texture) {
// currently only png textures are supported
if(!boost::ends_with(textureFile, ".png"))
logFatal("Unable to load texture %s, file format no supported.", textureFile.c_str());
flogFatal("FATAL ERROR: Unable to load texture %s, file format no supported.", textureFile.c_str());
// load texture file data
uint fileSize;
uchar *textureFileData = g_resources.loadFile(textureFile, &fileSize);
if(!textureFileData)
logFatal("Unable to load texture %s, file could not be read.", textureFile.c_str());
flogFatal("FATAL ERROR: Unable to load texture %s, file could not be read.", textureFile.c_str());
// load the texture
texture = TexturePtr(TextureLoader::loadPNG(textureFileData));
if(!texture)
logFatal("Unable to load texture %s", textureFile.c_str());
flogFatal("FATAL ERROR: Unable to load texture %s", textureFile.c_str());
delete[] textureFileData;
}