mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
change logger
This commit is contained in:
@@ -67,7 +67,7 @@ bool FontManager::importFont(std::string fontFile)
|
||||
|
||||
return true;
|
||||
} catch(stdext::exception& e) {
|
||||
logError("Unable to load font from file '%s': %s", fontFile, e.what());
|
||||
g_logger.error(stdext::format("Unable to load font from file '%s': %s", fontFile, e.what()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ FontPtr FontManager::getFont(const std::string& fontName)
|
||||
}
|
||||
|
||||
// when not found, fallback to default font
|
||||
logError("font '%s' not found", fontName);
|
||||
g_logger.error(stdext::format("font '%s' not found", fontName));
|
||||
return getDefaultFont();
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@ void FrameBuffer::internalCreate()
|
||||
if(g_graphics.canUseFBO()) {
|
||||
glGenFramebuffers(1, &m_fbo);
|
||||
if(!m_fbo)
|
||||
logFatal("Unable to create framebuffer object");
|
||||
g_logger.fatal("Unable to create framebuffer object");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ void FrameBuffer::resize(const Size& size)
|
||||
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if(status != GL_FRAMEBUFFER_COMPLETE)
|
||||
logFatal("Unable to setup framebuffer object");
|
||||
g_logger.fatal("Unable to setup framebuffer object");
|
||||
internalRelease();
|
||||
} else {
|
||||
m_screenBackup = TexturePtr(new Texture(size.width(), size.height()));
|
||||
|
@@ -45,8 +45,8 @@ Graphics::Graphics()
|
||||
|
||||
void Graphics::init()
|
||||
{
|
||||
logInfo("GPU %s", glGetString(GL_RENDERER));
|
||||
logInfo("OpenGL %s", glGetString(GL_VERSION));
|
||||
g_logger.info(stdext::format("GPU %s", glGetString(GL_RENDERER)));
|
||||
g_logger.info(stdext::format("OpenGL %s", glGetString(GL_VERSION)));
|
||||
|
||||
#if OPENGL_ES==2
|
||||
g_painterOGL2 = new PainterOGL2;
|
||||
@@ -56,7 +56,7 @@ void Graphics::init()
|
||||
// init GL extensions
|
||||
GLenum err = glewInit();
|
||||
if(err != GLEW_OK)
|
||||
logFatal("Unable to init GLEW: %s", glewGetErrorString(err));
|
||||
g_logger.fatal(stdext::format("Unable to init GLEW: %s", glewGetErrorString(err)));
|
||||
|
||||
// overwrite framebuffer API if needed
|
||||
if(GLEW_EXT_framebuffer_object && !GLEW_ARB_framebuffer_object) {
|
||||
@@ -162,7 +162,7 @@ bool Graphics::selectPainterEngine(PainterEngine painterEngine)
|
||||
#endif
|
||||
|
||||
if(!found)
|
||||
logFatal("Neither OpenGL 1.0 nor OpenGL 2.0 painter engine is supported by your platform, "
|
||||
g_logger.fatal("Neither OpenGL 1.0 nor OpenGL 2.0 painter engine is supported by your platform, "
|
||||
"try updating your graphics drivers or your hardware and then run again.");
|
||||
|
||||
// switch painters GL state
|
||||
|
@@ -46,7 +46,7 @@ ImagePtr Image::load(const std::string& file)
|
||||
// load image file data
|
||||
image = loadPNG(file);
|
||||
} catch(stdext::exception& e) {
|
||||
logError("unable to load image '%s': %s", file, e.what());
|
||||
g_logger.error(stdext::format("unable to load image '%s': %s", file, e.what()));
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
@@ -172,7 +172,7 @@ bool ParticleEmitter::load(const OTMLNodePtr& node)
|
||||
m_pColorsStops.push_back(0);
|
||||
|
||||
if(m_pColors.size() != m_pColorsStops.size()) {
|
||||
logError("particle colors must be equal to colorstops-1");
|
||||
g_logger.error(stdext::format("particle colors must be equal to colorstops-1"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ bool ParticleManager::load(const std::string& filename)
|
||||
}
|
||||
return true;
|
||||
} catch(stdext::exception& e) {
|
||||
logError("could not load particles: %s", e.what());
|
||||
g_logger.error(stdext::format("could not load particles: %s", e.what()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ Shader::Shader(Shader::ShaderType shaderType)
|
||||
}
|
||||
|
||||
if(!m_shaderId)
|
||||
logFatal("Unable to create GL shader");
|
||||
g_logger.fatal("Unable to create GL shader");
|
||||
}
|
||||
|
||||
Shader::~Shader()
|
||||
|
@@ -30,7 +30,7 @@ ShaderProgram::ShaderProgram()
|
||||
m_programId = glCreateProgram();
|
||||
m_uniformLocations.fill(-1);
|
||||
if(!m_programId)
|
||||
logFatal("Unable to create GL shader program");
|
||||
g_logger.fatal("Unable to create GL shader program");
|
||||
}
|
||||
|
||||
ShaderProgram::~ShaderProgram()
|
||||
@@ -48,7 +48,7 @@ bool ShaderProgram::addShader(const ShaderPtr& shader) {
|
||||
bool ShaderProgram::addShaderFromSourceCode(Shader::ShaderType shaderType, const std::string& sourceCode) {
|
||||
ShaderPtr shader(new Shader(shaderType));
|
||||
if(!shader->compileSourceCode(sourceCode)) {
|
||||
logError("failed to compile shader: %s", shader->log());
|
||||
g_logger.error(stdext::format("failed to compile shader: %s", shader->log()));
|
||||
return false;
|
||||
}
|
||||
return addShader(shader);
|
||||
@@ -57,7 +57,7 @@ bool ShaderProgram::addShaderFromSourceCode(Shader::ShaderType shaderType, const
|
||||
bool ShaderProgram::addShaderFromSourceFile(Shader::ShaderType shaderType, const std::string& sourceFile) {
|
||||
ShaderPtr shader(new Shader(shaderType));
|
||||
if(!shader->compileSourceFile(sourceFile)) {
|
||||
logError("failed to compile shader: %s", shader->log());
|
||||
g_logger.error(stdext::format("failed to compile shader: %s", shader->log()));
|
||||
return false;
|
||||
}
|
||||
return addShader(shader);
|
||||
@@ -92,7 +92,7 @@ bool ShaderProgram::link()
|
||||
m_linked = (value != GL_FALSE);
|
||||
|
||||
if(!m_linked)
|
||||
logTraceWarning(log());
|
||||
g_logger.traceWarning(log());
|
||||
return m_linked;
|
||||
}
|
||||
|
||||
|
@@ -82,10 +82,10 @@ uint Texture::internalLoadGLTexture(uchar *pixels, int channels, int width, int
|
||||
|
||||
// checks texture max size
|
||||
if(std::max(glSize.width(), glSize.height()) > g_graphics.getMaxTextureSize()) {
|
||||
logError("loading texture with size %dx%d failed, "
|
||||
g_logger.error(stdext::format("loading texture with size %dx%d failed, "
|
||||
"the maximum size allowed by the graphics card is %dx%d,"
|
||||
"to prevent crashes the texture will be displayed as a blank texture",
|
||||
width, height, g_graphics.getMaxTextureSize(), g_graphics.getMaxTextureSize());
|
||||
width, height, g_graphics.getMaxTextureSize(), g_graphics.getMaxTextureSize()));
|
||||
//TODO: make a workaround, could be bilinear scaling the texture
|
||||
return 0;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void Texture::generateMipmaps()
|
||||
//FIXME: disabled because mipmaps size needs to be in base of 2,
|
||||
// and the current algorithmn does not support that
|
||||
//generateSoftwareMipmaps(getPixels());
|
||||
logTraceError("non power of 2.");
|
||||
g_logger.traceError("non power of 2.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ TexturePtr TextureManager::getTexture(const std::string& fileName)
|
||||
g_resources.loadFile(filePath, fin);
|
||||
texture = loadPNG(fin);
|
||||
} catch(stdext::exception& e) {
|
||||
logError("unable to load texture '%s': %s", fileName, e.what());
|
||||
g_logger.error(stdext::format("unable to load texture '%s': %s", fileName, e.what()));
|
||||
texture = g_graphics.getEmptyTexture();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user