diff --git a/source/graphics/ColladaManager.cpp b/source/graphics/ColladaManager.cpp index 36bc2a4d29..9c4516c04d 100644 --- a/source/graphics/ColladaManager.cpp +++ b/source/graphics/ColladaManager.cpp @@ -18,9 +18,8 @@ namespace { void ColladaLog(int severity, const char* text) { - LOG(severity == LOG_INFO ? NORMAL : - severity == LOG_WARNING ? WARNING : ERROR, - "collada", "%s", text); + const CLogger::ELogMethod method = severity == LOG_INFO ? CLogger::Normal : severity == LOG_WARNING ? CLogger::Warning : CLogger::Error; + LOG(method, "collada", "%s", text); } void ColladaOutput(void* cb_data, const char* data, unsigned int length) @@ -63,7 +62,7 @@ public: { if (! dll.LoadDLL()) { - LOG_ONCE(ERROR, "collada", "Failed to load COLLADA conversion DLL"); + LOG_ONCE(CLogger::Error, "collada", "Failed to load COLLADA conversion DLL"); return false; } @@ -76,7 +75,7 @@ public: } catch (PSERROR_DllLoader&) { - LOG(ERROR, "collada", "Failed to load symbols from COLLADA conversion DLL"); + LOG(CLogger::Error, "collada", "Failed to load symbols from COLLADA conversion DLL"); dll.Unload(); return false; } @@ -86,7 +85,7 @@ public: CVFSFile skeletonFile; if (skeletonFile.Load("art/skeletons/skeletons.xml") != PSRETURN_OK) { - LOG(ERROR, "collada", "Failed to read skeleton definitions"); + LOG(CLogger::Error, "collada", "Failed to read skeleton definitions"); dll.Unload(); return false; } @@ -94,7 +93,7 @@ public: int ok = set_skeleton_definitions((const char*)skeletonFile.GetBuffer(), (int)skeletonFile.GetBufferSize()); if (ok < 0) { - LOG(ERROR, "collada", "Failed to load skeleton definitions"); + LOG(CLogger::Error, "collada", "Failed to load skeleton definitions"); dll.Unload(); return false; } @@ -189,7 +188,7 @@ CStr CColladaManager::GetLoadableFilename(const CStr& sourceName, FileType type) if (g_VFS->GetFileInfo(dae, &fileInfo) < 0) { // This shouldn't occur for any sensible reasons - LOG(ERROR, "collada", "Failed to stat DAE file '%s'", dae.c_str()); + LOG(CLogger::Error, "collada", "Failed to stat DAE file '%s'", dae.c_str()); return ""; } diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp index 7c35b48dc4..35cb9e093c 100644 --- a/source/graphics/MapReader.cpp +++ b/source/graphics/MapReader.cpp @@ -860,7 +860,7 @@ int CXMLReader::ReadEntities(XMBElement parent, double end_time) CEntityTemplate* base = g_EntityTemplateCollection.GetTemplate(TemplateName, g_Game->GetPlayer(PlayerID)); if (! base) - LOG(ERROR, LOG_CATEGORY, "Failed to load entity template '%ls'", TemplateName.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to load entity template '%ls'", TemplateName.c_str()); else { std::set selections; // TODO: read from file @@ -868,7 +868,7 @@ int CXMLReader::ReadEntities(XMBElement parent, double end_time) HEntity ent = g_EntityManager.Create(base, Position, Orientation, selections); if (! ent) - LOG(ERROR, LOG_CATEGORY, "Failed to create entity of type '%ls'", TemplateName.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to create entity of type '%ls'", TemplateName.c_str()); else { ent->m_actor->SetPlayerID(PlayerID); diff --git a/source/graphics/MeshManager.cpp b/source/graphics/MeshManager.cpp index d4d78b5ad0..b97f8480e7 100644 --- a/source/graphics/MeshManager.cpp +++ b/source/graphics/MeshManager.cpp @@ -43,7 +43,7 @@ CModelDefPtr CMeshManager::GetMesh(const CStr& filename) if (pmdFilename.empty()) { - LOG(ERROR, LOG_CATEGORY, "Could not load mesh '%s'", filename.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Could not load mesh '%s'", filename.c_str()); return CModelDefPtr(); } @@ -55,7 +55,7 @@ CModelDefPtr CMeshManager::GetMesh(const CStr& filename) } catch (PSERROR_File&) { - LOG(ERROR, LOG_CATEGORY, "Could not load mesh '%s'", filename.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Could not load mesh '%s'", filename.c_str()); return CModelDefPtr(); } } diff --git a/source/graphics/Model.cpp b/source/graphics/Model.cpp index 5826fe0a82..5c519cd471 100644 --- a/source/graphics/Model.cpp +++ b/source/graphics/Model.cpp @@ -382,7 +382,7 @@ bool CModel::SetAnimation(CSkeletonAnim* anim, bool once, float speed, CSkeleton if (anim->m_AnimDef && anim->m_AnimDef->GetNumKeys() != m_pModelDef->GetNumBones()) { // mismatch between model's skeleton and animation's skeleton - LOG(ERROR, LOG_CATEGORY, "Mismatch between model's skeleton and animation's skeleton (%d model bones != %d animation keys)", + LOG(CLogger::Error, LOG_CATEGORY, "Mismatch between model's skeleton and animation's skeleton (%d model bones != %d animation keys)", m_pModelDef->GetNumBones(), anim->m_AnimDef->GetNumKeys()); return false; } diff --git a/source/graphics/ObjectBase.cpp b/source/graphics/ObjectBase.cpp index f43102a217..4c77631410 100644 --- a/source/graphics/ObjectBase.cpp +++ b/source/graphics/ObjectBase.cpp @@ -69,7 +69,7 @@ bool CObjectBase::Load(const char* filename) if (root.GetNodeName() != el_actor) { - LOG(ERROR, LOG_CATEGORY, "Invalid actor format (unrecognised root element '%s')", XeroFile.GetElementString(root.GetNodeName()).c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Invalid actor format (unrecognised root element '%s')", XeroFile.GetElementString(root.GetNodeName()).c_str()); return false; } @@ -198,7 +198,7 @@ bool CObjectBase::Load(const char* filename) if (currentGroup->size() == 0) { - LOG(ERROR, LOG_CATEGORY, "Actor group has zero variants ('%s')", filename); + LOG(CLogger::Error, LOG_CATEGORY, "Actor group has zero variants ('%s')", filename); } ++currentGroup; diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index ebd3ee9211..21803d6525 100644 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -55,7 +55,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections str << variation.color; int r, g, b; if (! (str >> r >> g >> b)) // Any trailing data is ignored - LOG(ERROR, LOG_CATEGORY, "Invalid RGB colour '%s'", variation.color.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Invalid RGB colour '%s'", variation.color.c_str()); else m_Color = CColor(r/255.0f, g/255.0f, b/255.0f, 1.0f); } @@ -76,7 +76,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections CModelDefPtr modeldef (objectManager.GetMeshManager().GetMesh(m_ModelName)); if (!modeldef) { - LOG(ERROR, LOG_CATEGORY, "CObjectEntry::BuildModel(): Model %s failed to load", m_ModelName.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "CObjectEntry::BuildModel(): Model %s failed to load", m_ModelName.c_str()); return false; } @@ -128,7 +128,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections { // start up idling if (! m_Model->SetAnimation(GetRandomAnimation("idle"))) - LOG(ERROR, LOG_CATEGORY, "Failed to set idle animation in model \"%s\"", m_ModelName.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to set idle animation in model \"%s\"", m_ModelName.c_str()); } // build props - TODO, RC - need to fix up bounds here @@ -140,7 +140,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections CObjectEntry* oe = objectManager.FindObjectVariation(prop.m_ModelName, selections); if (!oe) { - LOG(ERROR, LOG_CATEGORY, "Failed to build prop model \"%s\" on actor \"%s\"", (const char*)prop.m_ModelName, (const char*)m_Base->m_ShortName); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to build prop model \"%s\" on actor \"%s\"", (const char*)prop.m_ModelName, (const char*)m_Base->m_ShortName); continue; } @@ -156,7 +156,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections m_AmmunitionModel = oe->m_Model; m_AmmunitionPoint = modeldef->FindPropPoint((const char*)ppn ); if (! m_AmmunitionPoint) - LOG(ERROR, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" on actor \"%s\"", (const char*)ppn, (const char*)m_ModelName, (const char*)prop.m_ModelName); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" on actor \"%s\"", (const char*)ppn, (const char*)m_ModelName, (const char*)prop.m_ModelName); } else { @@ -168,7 +168,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections propmodel->SetAnimation(oe->GetRandomAnimation("idle")); } else - LOG(ERROR, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" on actor \"%s\"", (const char*)prop.m_PropPointName, (const char*)m_ModelName, (const char*)prop.m_ModelName); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" on actor \"%s\"", (const char*)prop.m_PropPointName, (const char*)m_ModelName, (const char*)prop.m_ModelName); } } @@ -223,7 +223,7 @@ CSkeletonAnim* CObjectEntry::GetRandomAnimation(const CStr& animationName) size_t count = std::distance(lower, upper); if (count == 0) { -// LOG(WARNING, LOG_CATEGORY, "Failed to find animation '%s' for actor '%s'", animationName.c_str(), m_ModelName.c_str()); +// LOG(CLogger::Warning, LOG_CATEGORY, "Failed to find animation '%s' for actor '%s'", animationName.c_str(), m_ModelName.c_str()); return NULL; } else diff --git a/source/graphics/ObjectManager.cpp b/source/graphics/ObjectManager.cpp index f372b793c8..31dadd96f7 100644 --- a/source/graphics/ObjectManager.cpp +++ b/source/graphics/ObjectManager.cpp @@ -67,7 +67,7 @@ CObjectBase* CObjectManager::FindObjectBase(const char* objectname) else delete obj; - LOG(ERROR, LOG_CATEGORY, "CObjectManager::FindObjectBase(): Cannot find object '%s'", objectname); + LOG(CLogger::Error, LOG_CATEGORY, "CObjectManager::FindObjectBase(): Cannot find object '%s'", objectname); return 0; } diff --git a/source/graphics/SkeletonAnimManager.cpp b/source/graphics/SkeletonAnimManager.cpp index 6a74967a18..ca90cb4597 100644 --- a/source/graphics/SkeletonAnimManager.cpp +++ b/source/graphics/SkeletonAnimManager.cpp @@ -58,7 +58,7 @@ CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const CStr& filename) if (psaFilename.empty()) { - LOG(ERROR, LOG_CATEGORY, "Could not load animation '%s'", filename.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Could not load animation '%s'", filename.c_str()); def = NULL; } else @@ -74,9 +74,9 @@ CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const CStr& filename) } if (def) - LOG(NORMAL, LOG_CATEGORY, "CSkeletonAnimManager::GetAnimation(%s): Loaded successfully", filename.c_str()); + LOG(CLogger::Normal, LOG_CATEGORY, "CSkeletonAnimManager::GetAnimation(%s): Loaded successfully", filename.c_str()); else - LOG(ERROR, LOG_CATEGORY, "CSkeletonAnimManager::GetAnimation(%s): Failed loading, marked file as bad", filename.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "CSkeletonAnimManager::GetAnimation(%s): Failed loading, marked file as bad", filename.c_str()); // Add to map m_Animations[name] = def; // NULL if failed to load - we won't try loading it again diff --git a/source/graphics/TerrainProperties.cpp b/source/graphics/TerrainProperties.cpp index 51b024f018..04cf3e82db 100644 --- a/source/graphics/TerrainProperties.cpp +++ b/source/graphics/TerrainProperties.cpp @@ -39,7 +39,7 @@ CTerrainPropertiesPtr CTerrainProperties::FromXML(CTerrainPropertiesPtr parent, // Check that we've got the right kind of xml document if (rootName != "Terrains") { - LOG(ERROR, + LOG(CLogger::Error, LOG_CATEGORY, "TextureManager: Loading %s: Root node is not terrains (found \"%s\")", path, @@ -71,7 +71,7 @@ CTerrainPropertiesPtr CTerrainProperties::FromXML(CTerrainPropertiesPtr parent, } else { - LOG(WARNING, LOG_CATEGORY, + LOG(CLogger::Warning, LOG_CATEGORY, "TerrainProperties: Loading %s: Unexpected node %s\n", path, XeroFile.GetElementString(child.GetNodeName()).c_str()); diff --git a/source/graphics/TextureManager.cpp b/source/graphics/TextureManager.cpp index c32a1b026f..31e974bcc3 100644 --- a/source/graphics/TextureManager.cpp +++ b/source/graphics/TextureManager.cpp @@ -56,7 +56,7 @@ CTextureEntry* CTextureManager::FindTexture(CStr tag) return m_TextureEntries[i]; } - LOG(WARNING, LOG_CATEGORY, "TextureManager: Couldn't find terrain %s", tag.c_str()); + LOG(CLogger::Warning, LOG_CATEGORY, "TextureManager: Couldn't find terrain %s", tag.c_str()); return 0; } @@ -123,7 +123,7 @@ void CTextureManager::LoadTextures(CTerrainPropertiesPtr props, const char* dir) { myprops = GetPropertiesFromFile(props, xml_name); if (myprops) - LOG(NORMAL, LOG_CATEGORY, "CTextureManager: Successfully loaded override xml %s for texture %s", xml_name, texture_name); + LOG(CLogger::Normal, LOG_CATEGORY, "CTextureManager: Successfully loaded override xml %s for texture %s", xml_name, texture_name); } // Error or non-existant xml file -> use parent props @@ -136,7 +136,7 @@ void CTextureManager::LoadTextures(CTerrainPropertiesPtr props, const char* dir) void CTextureManager::RecurseDirectory(CTerrainPropertiesPtr parentProps, const char* cur_dir_path) { - //LOG(NORMAL, LOG_CATEGORY, "CTextureManager::RecurseDirectory(%s)", path.c_str()); + //LOG(CLogger::Normal, LOG_CATEGORY, "CTextureManager::RecurseDirectory(%s)", path.c_str()); CTerrainPropertiesPtr props; @@ -150,7 +150,7 @@ void CTextureManager::RecurseDirectory(CTerrainPropertiesPtr parentProps, const // No terrains.xml, or read failures -> use parent props (i.e. if (!props) { - LOG(NORMAL, LOG_CATEGORY, + LOG(CLogger::Normal, LOG_CATEGORY, "CTextureManager::RecurseDirectory(%s): no terrains.xml (or errors while loading) - using parent properties", cur_dir_path); props = parentProps; } diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 26ccaf78b3..629b24659c 100644 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -79,7 +79,7 @@ InReaction CGUI::HandleEvent(const SDL_Event_* ev) IGUIObject* object = FindObjectByName(objectName); if (! object) { - LOG(ERROR, LOG_CATEGORY, "Cannot find hotkeyed object '%s'", objectName.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Cannot find hotkeyed object '%s'", objectName.c_str()); } else { @@ -1031,13 +1031,13 @@ void CGUI::ReportParseError(const char *str, ...) // Print header if (m_Errors==0) { - LOG(ERROR, LOG_CATEGORY, "*** GUI Tree Creation Errors:"); + LOG(CLogger::Error, LOG_CATEGORY, "*** GUI Tree Creation Errors:"); } // Important, set ParseError to true ++m_Errors; - LOG(ERROR, LOG_CATEGORY, buffer); + LOG(CLogger::Error, LOG_CATEGORY, buffer); } /** @@ -1093,7 +1093,7 @@ void CGUI::LoadXmlFile(const string &Filename) } catch (PSERROR_GUI& e) { - LOG(ERROR, LOG_CATEGORY, "Errors loading GUI file %s (%s)", Filename.c_str(), e.getCode()); + LOG(CLogger::Error, LOG_CATEGORY, "Errors loading GUI file %s (%s)", Filename.c_str(), e.getCode()); return; } @@ -1360,7 +1360,7 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec CVFSFile scriptfile; if (scriptfile.Load(file) != PSRETURN_OK) { - LOG(ERROR, LOG_CATEGORY, "Error opening action file '%s'", file.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Error opening action file '%s'", file.c_str()); throw PSERROR_GUI_JSOpenFailed(); } @@ -1378,7 +1378,7 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec // Try making the object read the tag. if (!object->HandleAdditionalChildren(child, pFile)) { - LOG(ERROR, LOG_CATEGORY, "(object: %s) Reading unknown children for its type"); + LOG(CLogger::Error, LOG_CATEGORY, "(object: %s) Reading unknown children for its type"); } } } @@ -1463,7 +1463,7 @@ void CGUI::Xeromyces_ReadSprite(XMBElement Element, CXeromyces* pFile) name = Element.GetAttributes().GetNamedItem( pFile->GetAttributeID("name") ); if (m_Sprites.find(name) != m_Sprites.end()) - LOG(WARNING, LOG_CATEGORY, "Sprite name '%s' used more than once; first definition will be discarded", (const char*)name); + LOG(CLogger::Warning, LOG_CATEGORY, "Sprite name '%s' used more than once; first definition will be discarded", (const char*)name); // // Read Children (the images) diff --git a/source/gui/CList.cpp b/source/gui/CList.cpp index b7758cc65d..5ea0a67ffd 100644 --- a/source/gui/CList.cpp +++ b/source/gui/CList.cpp @@ -58,7 +58,7 @@ void CList::SetupText() CGUIList *pList; GUI::GetSettingPointer(this, "list", pList); - //LOG(ERROR, LOG_CATEGORY, "SetupText() %s", GetPresentableName().c_str()); + //LOG(CLogger::Error, LOG_CATEGORY, "SetupText() %s", GetPresentableName().c_str()); //debug_assert(m_GeneratedTexts.size()>=1); diff --git a/source/gui/GUIRenderer.cpp b/source/gui/GUIRenderer.cpp index 1ea6d3b4f6..a5e2e2558d 100644 --- a/source/gui/GUIRenderer.cpp +++ b/source/gui/GUIRenderer.cpp @@ -81,7 +81,7 @@ public: // Otherwise, complain. else { - LOG(WARNING, "gui", "add_color effect has some components above 127 and some below -127 - colours will be clamped"); + LOG(CLogger::Warning, "gui", "add_color effect has some components above 127 and some below -127 - colours will be clamped"); m_Color = CColor(c.r+0.5f, c.g+0.5f, c.b+0.5f, c.a+0.5f); m_Method = ADD_SIGNED; } @@ -160,7 +160,7 @@ public: ; else // Oops - trying to multiply by >4 - LOG(WARNING, "gui", "multiply_color effect has a component >1020 - colours will be clamped"); + LOG(CLogger::Warning, "gui", "multiply_color effect has a component >1020 - colours will be clamped"); m_Color = CColor(c.r/4.f, c.g/4.f, c.b/4.f, c.a); m_Scale = 4; @@ -362,7 +362,7 @@ void GUIRenderer::UpdateDrawCallCache(DrawCalls &Calls, CStr& SpriteName, CRect else { // Otherwise, just complain and give up: - LOG(ERROR, LOG_CATEGORY, "Trying to use a sprite that doesn't exist (\"%s\").", (const char*)SpriteName); + LOG(CLogger::Error, LOG_CATEGORY, "Trying to use a sprite that doesn't exist (\"%s\").", (const char*)SpriteName); return; } } @@ -391,7 +391,7 @@ void GUIRenderer::UpdateDrawCallCache(DrawCalls &Calls, CStr& SpriteName, CRect Handle h = ogl_tex_load(cit->m_TextureName); if (h <= 0) { - LOG(ERROR, LOG_CATEGORY, "Error reading texture '%s': %lld", (const char*)cit->m_TextureName, h); + LOG(CLogger::Error, LOG_CATEGORY, "Error reading texture '%s': %lld", (const char*)cit->m_TextureName, h); return; } @@ -400,7 +400,7 @@ void GUIRenderer::UpdateDrawCallCache(DrawCalls &Calls, CStr& SpriteName, CRect int err = ogl_tex_upload(h); if (err < 0) { - LOG(ERROR, LOG_CATEGORY, "Error uploading texture '%s': %d", (const char*)cit->m_TextureName, err); + LOG(CLogger::Error, LOG_CATEGORY, "Error uploading texture '%s': %d", (const char*)cit->m_TextureName, err); return; } diff --git a/source/gui/GUITooltip.cpp b/source/gui/GUITooltip.cpp index ab6eba2656..19d8cf7e59 100644 --- a/source/gui/GUITooltip.cpp +++ b/source/gui/GUITooltip.cpp @@ -101,7 +101,7 @@ void GUITooltip::ShowTooltip(IGUIObject* obj, CPos pos, const CStr& style, CGUI* IGUIObject* tooltipobj = gui->FindObjectByName("__tooltip_"+style); if (! tooltipobj) { - LOG_ONCE(ERROR, "gui", "Cannot find tooltip named '%s'", (const char*)style); + LOG_ONCE(CLogger::Error, "gui", "Cannot find tooltip named '%s'", (const char*)style); return; } @@ -114,7 +114,7 @@ void GUITooltip::ShowTooltip(IGUIObject* obj, CPos pos, const CStr& style, CGUI* usedobj = gui->FindObjectByName(usedObjectName); if (! usedobj) { - LOG_ONCE(ERROR, "gui", "Cannot find object named '%s' used by tooltip '%s'", (const char*)usedObjectName, (const char*)style); + LOG_ONCE(CLogger::Error, "gui", "Cannot find object named '%s' used by tooltip '%s'", (const char*)usedObjectName, (const char*)style); return; } @@ -157,7 +157,7 @@ void GUITooltip::HideTooltip(const CStr& style, CGUI* gui) IGUIObject* tooltipobj = gui->FindObjectByName("__tooltip_"+style); if (! tooltipobj) { - LOG_ONCE(ERROR, "gui", "Cannot find tooltip named '%s'", (const char*)style); + LOG_ONCE(CLogger::Error, "gui", "Cannot find tooltip named '%s'", (const char*)style); return; } @@ -168,7 +168,7 @@ void GUITooltip::HideTooltip(const CStr& style, CGUI* gui) IGUIObject* usedobj = gui->FindObjectByName(usedObjectName); if (! usedobj) { - LOG_ONCE(ERROR, "gui", "Cannot find object named '%s' used by tooltip '%s'", (const char*)usedObjectName, (const char*)style); + LOG_ONCE(CLogger::Error, "gui", "Cannot find object named '%s' used by tooltip '%s'", (const char*)usedObjectName, (const char*)style); return; } @@ -198,7 +198,7 @@ static int GetTooltipDelay(CStr& style, CGUI* gui) IGUIObject* tooltipobj = gui->FindObjectByName("__tooltip_"+style); if (! tooltipobj) { - LOG_ONCE(ERROR, "gui", "Cannot find tooltip object named '%s'", (const char*)style); + LOG_ONCE(CLogger::Error, "gui", "Cannot find tooltip object named '%s'", (const char*)style); return delay; } GUI::GetSetting(tooltipobj, "delay", delay); diff --git a/source/gui/GUItext.cpp b/source/gui/GUItext.cpp index c0deb749e9..36cdd1c971 100644 --- a/source/gui/GUItext.cpp +++ b/source/gui/GUItext.cpp @@ -94,7 +94,7 @@ void CGUIString::GenerateTextCall(SFeedback &Feedback, } else if (pObject) { - LOG(ERROR, LOG_CATEGORY, "Trying to use an [imgleft]-tag with an undefined icon (\"%s\").", itTextChunk->m_Tags[0].m_TagValue.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Trying to use an [imgleft]-tag with an undefined icon (\"%s\").", itTextChunk->m_Tags[0].m_TagValue.c_str()); } } else @@ -107,7 +107,7 @@ void CGUIString::GenerateTextCall(SFeedback &Feedback, } else if (pObject) { - LOG(ERROR, LOG_CATEGORY, "Trying to use an [imgright]-tag with an undefined icon (\"%s\").", itTextChunk->m_Tags[0].m_TagValue.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Trying to use an [imgright]-tag with an undefined icon (\"%s\").", itTextChunk->m_Tags[0].m_TagValue.c_str()); } } else @@ -145,7 +145,7 @@ void CGUIString::GenerateTextCall(SFeedback &Feedback, CSize displacement; // Parse the value if (!GUI::ParseString(itTextChunk->m_Tags[0].m_TagAdditionalValue, displacement)) - LOG(ERROR, LOG_CATEGORY, "Error parsing 'displace' value for tag [ICON]"); + LOG(CLogger::Error, LOG_CATEGORY, "Error parsing 'displace' value for tag [ICON]"); else SpriteCall.m_Area += displacement; } @@ -164,7 +164,7 @@ void CGUIString::GenerateTextCall(SFeedback &Feedback, } else if (pObject) { - LOG(ERROR, LOG_CATEGORY, "Trying to use an [icon]-tag with an undefined icon (\"%s\").", itTextChunk->m_Tags[0].m_TagValue.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Trying to use an [icon]-tag with an undefined icon (\"%s\").", itTextChunk->m_Tags[0].m_TagValue.c_str()); } } } @@ -193,7 +193,7 @@ void CGUIString::GenerateTextCall(SFeedback &Feedback, if (!GUI::ParseString(it2->m_TagValue, TextCall.m_Color)) { if (pObject) - LOG(ERROR, LOG_CATEGORY, "Error parsing the value of a [color]-tag in GUI text when reading object \"%s\".", pObject->GetPresentableName().c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Error parsing the value of a [color]-tag in GUI text when reading object \"%s\".", pObject->GetPresentableName().c_str()); } } else @@ -395,7 +395,7 @@ void CGUIString::SetValue(const CStrW& str) } else { - LOG(WARNING, LOG_CATEGORY, "Trying to declare an additional attribute ('%s') in a [%s]-tag, which the tag isn't accepting", str.c_str(), Str_TagType.c_str()); + LOG(CLogger::Warning, LOG_CATEGORY, "Trying to declare an additional attribute ('%s') in a [%s]-tag, which the tag isn't accepting", str.c_str(), Str_TagType.c_str()); } } @@ -574,15 +574,15 @@ void CGUIString::SetValue(const CStrW& str) #if 0 for (int i=0; i<(int)m_Words.size(); ++i) { - LOG(NORMAL, LOG_CATEGORY, "m_Words[%d] = %d", i, m_Words[i]); + LOG(CLogger::Normal, LOG_CATEGORY, "m_Words[%d] = %d", i, m_Words[i]); } for (int i=0; i<(int)m_TextChunks.size(); ++i) { - LOG(NORMAL, LOG_CATEGORY, "m_TextChunk[%d] = [%d,%d]", i, m_TextChunks[i].m_From, m_TextChunks[i].m_To); + LOG(CLogger::Normal, LOG_CATEGORY, "m_TextChunk[%d] = [%d,%d]", i, m_TextChunks[i].m_From, m_TextChunks[i].m_To); for (int j=0; j<(int)m_TextChunks[i].m_Tags.size(); ++j) { - LOG(NORMAL, LOG_CATEGORY, "--Tag: %d \"%s\"", (int)m_TextChunks[i].m_Tags[j].m_TagType, m_TextChunks[i].m_Tags[j].m_TagValue.c_str()); + LOG(CLogger::Normal, LOG_CATEGORY, "--Tag: %d \"%s\"", (int)m_TextChunks[i].m_Tags[j].m_TagType, m_TextChunks[i].m_Tags[j].m_TagValue.c_str()); } } #endif diff --git a/source/i18n/CLocale.cpp b/source/i18n/CLocale.cpp index 1dd998e316..d8674dd5b2 100644 --- a/source/i18n/CLocale.cpp +++ b/source/i18n/CLocale.cpp @@ -165,19 +165,19 @@ bool CLocale::LoadFunctions(const char* data, size_t len, const char* filename) if (len < 2) { - LOG(ERROR, LOG_CATEGORY, "I18n: Functions file '%s' is too short", filename); + LOG(CLogger::Error, LOG_CATEGORY, "I18n: Functions file '%s' is too short", filename); return false; } if (*(jschar*)data != 0xFEFF) { - LOG(ERROR, LOG_CATEGORY, "I18n: Functions file '%s' has invalid Unicode format (lacking little-endian BOM)", filename); + LOG(CLogger::Error, LOG_CATEGORY, "I18n: Functions file '%s' has invalid Unicode format (lacking little-endian BOM)", filename); return false; } if (! Script.ExecuteCode((jschar*)(data+2), len/2, filename)) { - LOG(ERROR, LOG_CATEGORY, "I18n: JS errors in functions file '%s'", filename); + LOG(CLogger::Error, LOG_CATEGORY, "I18n: JS errors in functions file '%s'", filename); return false; } @@ -196,7 +196,7 @@ bool CLocale::LoadDictionary(const char* data) if (dict.DictProperties.size() && PropertyCount != dict.DictProperties.size()) { - LOG(ERROR, LOG_CATEGORY, "I18n: Multiple dictionary files loaded with the name ('%ls') and different properties", DictName.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "I18n: Multiple dictionary files loaded with the name ('%ls') and different properties", DictName.c_str()); return false; // TODO: Check headings to make sure they're identical (or handle them more cleverly) } @@ -243,7 +243,7 @@ const CLocale::LookupType* CLocale::LookupWord(const Str& dictname, const Str& w std::map::const_iterator dictit = Dictionaries.find(dictname); if (dictit == Dictionaries.end()) { - LOG(WARNING, LOG_CATEGORY, "I18n: Non-loaded dictionary '%ls' accessed", dictname.c_str()); + LOG(CLogger::Warning, LOG_CATEGORY, "I18n: Non-loaded dictionary '%ls' accessed", dictname.c_str()); return NULL; } std::map >::const_iterator wordit = dictit->second.DictWords.find(word); @@ -290,7 +290,7 @@ StringBuffer CLocale::Translate(const wchar_t* id) StringsType::iterator TransStr = Strings.find(Str(id)); if (TransStr == Strings.end()) { - LOG(WARNING, LOG_CATEGORY, "I18n: No translation found for string '%ls'", id); + LOG(CLogger::Warning, LOG_CATEGORY, "I18n: No translation found for string '%ls'", id); // Just use the ID string directly, and remember it for the future return StringBuffer(&AddDefaultString(id), this); diff --git a/source/i18n/Interface.cpp b/source/i18n/Interface.cpp index 7e4e04d82a..259c4863fb 100644 --- a/source/i18n/Interface.cpp +++ b/source/i18n/Interface.cpp @@ -70,7 +70,7 @@ CLocale_interface* I18n::NewLocale(JSContext* cx, JSObject* scope) } catch (PSERROR_I18n& e) { - LOG(ERROR, LOG_CATEGORY, "Error creating locale object ('%s')", GetErrorString(e)); + LOG(CLogger::Error, LOG_CATEGORY, "Error creating locale object ('%s')", GetErrorString(e)); return NULL; } } diff --git a/source/i18n/ScriptInterface.cpp b/source/i18n/ScriptInterface.cpp index 8eb01d3796..7a02c7e671 100644 --- a/source/i18n/ScriptInterface.cpp +++ b/source/i18n/ScriptInterface.cpp @@ -323,7 +323,7 @@ const StrImW ScriptObject::CallFunction(const char* name, const std::vectorVarCount) { - LOG(ERROR, LOG_CATEGORY, "I18n: Incorrect number of parameters passed to Translate"); + LOG(CLogger::Error, LOG_CATEGORY, "I18n: Incorrect number of parameters passed to Translate"); // Tidy up std::for_each(Variables.begin(), Variables.end(), delete_fn); diff --git a/source/network/Client.cpp b/source/network/Client.cpp index 9584a32f18..7e114779e4 100644 --- a/source/network/Client.cpp +++ b/source/network/Client.cpp @@ -97,7 +97,7 @@ bool CNetClient::JSI_BeginConnect(JSContext* UNUSED(cx), uintN argc, jsval *argv PS_RESULT res=BeginConnect(connectHostName.c_str(), connectPort); if (res != PS_OK) { - LOG(ERROR, LOG_CAT_NET, "CNetClient::JSI_Connect(): BeginConnect error: %s", res); + LOG(CLogger::Error, LOG_CAT_NET, "CNetClient::JSI_Connect(): BeginConnect error: %s", res); return false; } else @@ -144,7 +144,7 @@ bool CNetClient::ConnectHandler(CNetMessage *pMsg, CNetSession *pSession) case NMT_ERROR: { CNetErrorMessage *msg=(CNetErrorMessage *)pMsg; - LOG(ERROR, LOG_CAT_NET, "CNetClient::ConnectHandler(): Connect Failed: %s", msg->m_Error); + LOG(CLogger::Error, LOG_CAT_NET, "CNetClient::ConnectHandler(): Connect Failed: %s", msg->m_Error); if (pClient->m_OnConnectComplete.Defined()) { CConnectCompleteEvent evt(CStr(msg->m_Error), false); @@ -228,11 +228,11 @@ bool CNetClient::AuthenticateHandler(CNetMessage *pMsg, CNetSession *pSession) CAuthenticationResult *msg=(CAuthenticationResult *)pMsg; if (msg->m_Code != NRC_OK) { - LOG(ERROR, LOG_CAT_NET, "CNetClient::AuthenticateHandler(): Authentication failed: %ls", msg->m_Message.c_str()); + LOG(CLogger::Error, LOG_CAT_NET, "CNetClient::AuthenticateHandler(): Authentication failed: %ls", msg->m_Message.c_str()); } else { - LOG(NORMAL, LOG_CAT_NET, "CNetClient::AuthenticateHandler(): Authenticated!"); + LOG(CLogger::Normal, LOG_CAT_NET, "CNetClient::AuthenticateHandler(): Authenticated!"); pClient->m_SessionID=msg->m_SessionID; pClient->m_pMessageHandler=PreGameHandler; } @@ -304,7 +304,7 @@ bool CNetClient::PreGameHandler(CNetMessage *pMsg, CNetSession *pSession) pSlot->AssignOpen(); break; default: - LOG(WARNING, LOG_CAT_NET, "CNetClient::PreGameHandler(): Received an invalid slot assignment %s", msg->GetString().c_str()); + LOG(CLogger::Warning, LOG_CAT_NET, "CNetClient::PreGameHandler(): Received an invalid slot assignment %s", msg->GetString().c_str()); } HANDLED(pMsg); } @@ -413,7 +413,7 @@ void CNetClient::OnClientDisconnect(int sessionID) SessionMap::iterator it=m_ServerSessions.find(sessionID); if (it == m_ServerSessions.end()) { - LOG(WARNING, LOG_CAT_NET, "Server said session %d disconnected. I don't know of such a session."); + LOG(CLogger::Warning, LOG_CAT_NET, "Server said session %d disconnected. I don't know of such a session."); } // Call JS Callback diff --git a/source/network/NetMessage.cpp b/source/network/NetMessage.cpp index 083e2b4131..bc5b0ec2f9 100644 --- a/source/network/NetMessage.cpp +++ b/source/network/NetMessage.cpp @@ -45,7 +45,7 @@ const u8 *CNetMessage::Deserialize(const u8* pos, const u8* UNUSED(end)) CNetMessage *CNetMessage::Copy() const { - LOG(ERROR, LOG_CAT_NET, "CNetMessage::Copy(): Attempting to copy non-copyable message!"); + LOG(CLogger::Error, LOG_CAT_NET, "CNetMessage::Copy(): Attempting to copy non-copyable message!"); return new CNetMessage(NMT_NONE); } @@ -64,7 +64,7 @@ CNetMessage *CNetMessage::DeserializeMessage(ENetMessageType type, u8 *buffer, u MessageDeserializerMap::const_iterator dEntry=g_DeserializerMap.find(type); if (dEntry == g_DeserializerMap.end()) { - LOG(WARNING, LOG_CAT_NET, "Unknown message received on socket: type 0x%04x, length %u", type, length); + LOG(CLogger::Warning, LOG_CAT_NET, "Unknown message received on socket: type 0x%04x, length %u", type, length); return NULL; } NetMessageDeserializer pDes=dEntry->second; diff --git a/source/network/Network.cpp b/source/network/Network.cpp index 1dcbf829ed..710773c98d 100644 --- a/source/network/Network.cpp +++ b/source/network/Network.cpp @@ -150,7 +150,7 @@ void CMessageSocket::StartWriteNextMessage() } else if (pMsg->GetType() < 0) { - LOG(WARNING, LOG_CAT_NET, "CMessageSocket::StartWriteNextMessage(): Non-network message"); + LOG(CLogger::Warning, LOG_CAT_NET, "CMessageSocket::StartWriteNextMessage(): Non-network message"); delete pMsg; pMsg=NULL; } diff --git a/source/network/Server.cpp b/source/network/Server.cpp index 261753462a..a4aa793b61 100644 --- a/source/network/Server.cpp +++ b/source/network/Server.cpp @@ -37,7 +37,7 @@ CNetServerSession *CNetServer::CreateSession(CSocketInternal *pInt) // NOTE: Called in network thread void CNetServer::OnAccept(const CSocketAddress &addr) { - LOG(NORMAL, LOG_CAT_NET, "CNetServer::OnAccept(): Accepted connection from %s port %d", addr.GetString().c_str(), addr.GetPort()); + LOG(CLogger::Normal, LOG_CAT_NET, "CNetServer::OnAccept(): Accepted connection from %s port %d", addr.GetString().c_str(), addr.GetPort()); CSocketInternal *pInt=Accept(); CNetServerSession *pSession=CreateSession(pInt); @@ -116,7 +116,7 @@ bool CNetServer::JSI_Open(JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUS PS_RESULT res=Bind(addr); if (res != PS_OK) { - LOG(ERROR, LOG_CAT_NET, "CNetServer::JSI_Open(): Bind error: %s", res); + LOG(CLogger::Error, LOG_CAT_NET, "CNetServer::JSI_Open(): Bind error: %s", res); return false; } @@ -425,7 +425,7 @@ void CNetServer::QueueLocalCommand(CNetMessage *pMsg) void CNetServer::QueueIncomingCommand(CNetMessage *pMsg) { CScopeLock lock(m_Mutex); - LOG(NORMAL, LOG_CAT_NET, "CNetServer::QueueIncomingCommand(): %s.", pMsg->GetString().c_str()); + LOG(CLogger::Normal, LOG_CAT_NET, "CNetServer::QueueIncomingCommand(): %s.", pMsg->GetString().c_str()); debug_printf("Got a command! queueing it to 2 turns from now\n"); QueueMessage(2, pMsg); } diff --git a/source/network/ServerSession.cpp b/source/network/ServerSession.cpp index 5c70f65f1d..63ebedecf0 100644 --- a/source/network/ServerSession.cpp +++ b/source/network/ServerSession.cpp @@ -49,7 +49,7 @@ bool CNetServerSession::BaseHandler(CNetMessage *pMsg, CNetSession *pNetSession) delete pSession; } else // error, but not disconnected? something weird is up... - LOG(WARNING, LOG_CAT_NET, "CNetServerSession::BaseHandler(): NMT_ERROR: %s", msg->GetString().c_str()); + LOG(CLogger::Warning, LOG_CAT_NET, "CNetServerSession::BaseHandler(): NMT_ERROR: %s", msg->GetString().c_str()); HANDLED(pMsg); } @@ -61,7 +61,7 @@ bool CNetServerSession::BaseHandler(CNetMessage *pMsg, CNetSession *pNetSession) bool CNetServerSession::HandshakeHandler(CNetMessage *pMsg, CNetSession *pNetSession) { CNetServerSession *pSession=(CNetServerSession *)pNetSession; - LOG(NORMAL, LOG_CAT_NET, "CNetServerSession::HandshakeHandler(): %s.", pMsg->GetString().c_str()); + LOG(CLogger::Normal, LOG_CAT_NET, "CNetServerSession::HandshakeHandler(): %s.", pMsg->GetString().c_str()); switch (pMsg->GetType()) { case NMT_ClientHandshake: @@ -94,14 +94,14 @@ bool CNetServerSession::AuthenticateHandler(CNetMessage *pMsg, CNetSession *pNet { CNetServerSession *pSession=(CNetServerSession *)pNetSession; CNetServer *pServer=pSession->m_pServer; - LOG(NORMAL, LOG_CAT_NET, "CNetServerSession::AuthenticateHandler(): %s.", pMsg->GetString().c_str()); + LOG(CLogger::Normal, LOG_CAT_NET, "CNetServerSession::AuthenticateHandler(): %s.", pMsg->GetString().c_str()); if (pMsg->GetType() == NMT_Authenticate) { CAuthenticate *msg=(CAuthenticate *)pMsg; if (msg->m_Password == pSession->m_pServer->m_Password) { - LOG(NORMAL, LOG_CAT_NET, "CNetServerSession::AuthenticateHandler(): Login Successful"); + LOG(CLogger::Normal, LOG_CAT_NET, "CNetServerSession::AuthenticateHandler(): Login Successful"); pSession->m_Name=msg->m_Name; pServer->AssignSessionID(pSession); @@ -124,7 +124,7 @@ bool CNetServerSession::AuthenticateHandler(CNetMessage *pMsg, CNetSession *pNet } else { - LOG(WARNING, LOG_CAT_NET, "CNetServerSession::AuthenticateHandler(): Login Failed"); + LOG(CLogger::Warning, LOG_CAT_NET, "CNetServerSession::AuthenticateHandler(): Login Failed"); CAuthenticationResult *msg=new CAuthenticationResult(); msg->m_Code=NRC_PasswordInvalid; msg->m_SessionID=0; @@ -175,7 +175,7 @@ bool CNetServerSession::InGameHandler(CNetMessage *pMsg, CNetSession *pNetSessio { CNetServerSession *pSession=(CNetServerSession *)pNetSession; if (pMsg->GetType() != NMT_EndCommandBatch) - LOG(NORMAL, LOG_CAT_NET, "CNetServerSession::InGameHandler(): %s.", pMsg->GetString().c_str()); + LOG(CLogger::Normal, LOG_CAT_NET, "CNetServerSession::InGameHandler(): %s.", pMsg->GetString().c_str()); if (BaseHandler(pMsg, pNetSession)) return true; diff --git a/source/network/SessionManager.cpp b/source/network/SessionManager.cpp index e94248180a..e0eb08dc0c 100644 --- a/source/network/SessionManager.cpp +++ b/source/network/SessionManager.cpp @@ -72,7 +72,7 @@ void CSessionManager::Poll() m_Mutex.Unlock(); if (!pSess->HandleMessage(pMsg)) { - LOG(WARNING, LOG_CAT_NET, "CSessionManager::Poll(): Unhandled message %s.", pMsg->GetString().c_str()); + LOG(CLogger::Warning, LOG_CAT_NET, "CSessionManager::Poll(): Unhandled message %s.", pMsg->GetString().c_str()); delete pMsg; } m_Mutex.Lock(); diff --git a/source/network/SocketBase.cpp b/source/network/SocketBase.cpp index 736b136b84..f07483411c 100644 --- a/source/network/SocketBase.cpp +++ b/source/network/SocketBase.cpp @@ -58,7 +58,7 @@ PS_RESULT GetPS_RESULT(int error) default: char buf[256]; Network_GetErrorString(error, buf, sizeof(buf)); - LOG(ERROR, LOG_CAT_NET, "SocketBase.cpp::GetPS_RESULT(): Unrecognized error %s[%d]", buf, error); + LOG(CLogger::Error, LOG_CAT_NET, "SocketBase.cpp::GetPS_RESULT(): Unrecognized error %s[%d]", buf, error); return PS_FAIL; } } @@ -471,7 +471,7 @@ PS_RESULT CSocketBase::Bind(const CSocketAddress &address) break; default: Network_GetErrorString(err, errBuf, sizeof(errBuf)); - LOG(ERROR, LOG_CAT_NET, "CServerSocket::Bind(): bind: %s [%d] => PS_FAIL", errBuf, err); + LOG(CLogger::Error, LOG_CAT_NET, "CServerSocket::Bind(): bind: %s [%d] => PS_FAIL", errBuf, err); } m_State=SS_UNCONNECTED; m_Error=ret; @@ -483,7 +483,7 @@ PS_RESULT CSocketBase::Bind(const CSocketAddress &address) { int err=Network_LastError; Network_GetErrorString(err, errBuf, sizeof(errBuf)); - LOG(ERROR, LOG_CAT_NET, "CServerSocket::Bind(): listen: %s [%d] => PS_FAIL", errBuf, err); + LOG(CLogger::Error, LOG_CAT_NET, "CServerSocket::Bind(): listen: %s [%d] => PS_FAIL", errBuf, err); m_State=SS_UNCONNECTED; return PS_FAIL; } diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index 56b41f6681..78b83c5de2 100644 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -52,7 +52,7 @@ CConsole::CConsole() shared_ptr buf; size_t size; if ( g_VFS->LoadFile("gui/text/help.txt", buf, size) < 0 ) { - LOG( ERROR,"Console", "Help file not found for console" ); + LOG(CLogger::Error, "Console", "Help file not found for console"); return; } // TODO: read in text mode, or at least get rid of the \r\n somehow diff --git a/source/ps/CLogger.cpp b/source/ps/CLogger.cpp index 2ab7e46690..96a3e0b0da 100644 --- a/source/ps/CLogger.cpp +++ b/source/ps/CLogger.cpp @@ -148,11 +148,11 @@ void CLogger::WriteWarning(const char *message, int interestedness) // Sends the message to the appropriate piece of code void CLogger::LogUsingMethod(ELogMethod method, const char* category, const char* message) { - if(method == NORMAL) + if(method == Normal) WriteMessage(message, Interestedness(category)); - else if(method == ERROR) + else if(method == Error) WriteError(message, Interestedness(category)); - else if(method == WARNING) + else if(method == Warning) WriteWarning(message, Interestedness(category)); else WriteMessage(message, Interestedness(category)); diff --git a/source/ps/CLogger.h b/source/ps/CLogger.h index 6188eb609a..80f488b9d4 100644 --- a/source/ps/CLogger.h +++ b/source/ps/CLogger.h @@ -12,18 +12,16 @@ extern CLogger* g_Logger; #define LOG (g_Logger->Log) #define LOG_ONCE (g_Logger->LogOnce) -enum ELogMethod -{ - NORMAL, - MESSAGE = NORMAL, - ERROR, - WARNING -}; - class CLogger : boost::noncopyable { public: - + enum ELogMethod + { + Normal, + Error, + Warning + }; + // Default constructor - outputs to normal log files CLogger(); diff --git a/source/ps/ConfigDB.cpp b/source/ps/ConfigDB.cpp index 9076efb887..eca4455035 100644 --- a/source/ps/ConfigDB.cpp +++ b/source/ps/ConfigDB.cpp @@ -260,7 +260,7 @@ bool CConfigDB::Reload(EConfigNamespace ns) LibError ret = g_VFS->LoadFile(m_ConfigFile[ns], buffer, buflen); if(ret != INFO::OK) { - LOG(ERROR, LOG_CATEGORY, "vfs_load for \"%s\" failed: return was %lld", m_ConfigFile[ns].c_str(), ret); + LOG(CLogger::Error, LOG_CATEGORY, "vfs_load for \"%s\" failed: return was %lld", m_ConfigFile[ns].c_str(), ret); return false; } } @@ -304,7 +304,7 @@ bool CConfigDB::Reload(EConfigNamespace ns) CConfigValue argument; argument.m_String = value; newMap[name].push_back( argument ); - LOG(NORMAL, LOG_CATEGORY, "Loaded config string \"%s\" = \"%s\"", name.c_str(), value.c_str()); + LOG(CLogger::Normal, LOG_CATEGORY, "Loaded config string \"%s\" = \"%s\"", name.c_str(), value.c_str()); } } } @@ -339,7 +339,7 @@ bool CConfigDB::WriteFile(EConfigNamespace ns, bool useVFS, const CStr& path) LibError ret = g_VFS->CreateFile(filepath, buf, len); if(ret < 0) { - LOG(ERROR, LOG_CATEGORY, "CConfigDB::WriteFile(): CreateFile \"%s\" failed (error: %d)", filepath, (int)ret); + LOG(CLogger::Error, LOG_CATEGORY, "CConfigDB::WriteFile(): CreateFile \"%s\" failed (error: %d)", filepath, (int)ret); return false; } diff --git a/source/ps/DllLoader.cpp b/source/ps/DllLoader.cpp index 49a5e31d95..48108d02ef 100644 --- a/source/ps/DllLoader.cpp +++ b/source/ps/DllLoader.cpp @@ -69,7 +69,7 @@ bool DllLoader::LoadDLL() { char* error = dlerror(); if (error) - LOG(ERROR, "", "dlopen error: %s", error); + LOG(CLogger::Error, "", "dlopen error: %s", error); m_Handle = HANDLE_UNAVAILABLE; } } diff --git a/source/ps/Filesystem.cpp b/source/ps/Filesystem.cpp index 06e8026097..885e3f5d8f 100644 --- a/source/ps/Filesystem.cpp +++ b/source/ps/Filesystem.cpp @@ -34,7 +34,7 @@ PSRETURN CVFSFile::Load(const char* filename) LibError ret = g_VFS->LoadFile(filename, m_Buffer, m_BufferSize); if (ret != INFO::OK) { - LOG(ERROR, LOG_CATEGORY, "CVFSFile: file %s couldn't be opened (vfs_load: %d)", filename, ret); + LOG(CLogger::Error, LOG_CATEGORY, "CVFSFile: file %s couldn't be opened (vfs_load: %d)", filename, ret); return PSRETURN_CVFSFile_LoadFailed; } diff --git a/source/ps/Font.cpp b/source/ps/Font.cpp index a0cc2bfef1..9a27884468 100644 --- a/source/ps/Font.cpp +++ b/source/ps/Font.cpp @@ -38,7 +38,7 @@ CFont::CFont(const char* name) return; // Not found as a font -- give up and use the default. - LOG_ONCE(ERROR, LOG_CATEGORY, "Failed to find font '%s'", name); + LOG_ONCE(CLogger::Error, LOG_CATEGORY, "Failed to find font '%s'", name); h = unifont_load(DefaultFont); // Assume this worked } diff --git a/source/ps/Game.cpp b/source/ps/Game.cpp index 8b6932bfa9..a95b3db607 100644 --- a/source/ps/Game.cpp +++ b/source/ps/Game.cpp @@ -312,14 +312,14 @@ CPlayer *CGame::GetPlayer(uint idx) if (idx > m_NumPlayers) { // debug_warn("Invalid player ID"); -// LOG(ERROR, "", "Invalid player ID %d (outside 0..%d)", idx, m_NumPlayers); +// LOG(CLogger::Error, "", "Invalid player ID %d (outside 0..%d)", idx, m_NumPlayers); return m_Players[0]; } // Be a bit more paranoid - maybe m_Players hasn't been set large enough else if (idx >= m_Players.size()) { debug_warn("Invalid player ID"); - LOG(ERROR, "", "Invalid player ID %d (not <=%d - internal error?)", idx, m_Players.size()); + LOG(CLogger::Error, "", "Invalid player ID %d (not <=%d - internal error?)", idx, m_Players.size()); if (m_Players.size() != 0) return m_Players[0]; diff --git a/source/ps/GameAttributes.cpp b/source/ps/GameAttributes.cpp index b6af324145..0f92a905cf 100644 --- a/source/ps/GameAttributes.cpp +++ b/source/ps/GameAttributes.cpp @@ -214,7 +214,7 @@ CGameAttributes::CGameAttributes(): CXeromyces XeroFile; if (XeroFile.Load("temp/players.xml") != PSRETURN_OK) { - LOG(ERROR, "", "Failed to load players list (temp/players.xml)"); + LOG(CLogger::Error, "", "Failed to load players list (temp/players.xml)"); // Basic default players @@ -343,7 +343,7 @@ CPlayer *CGameAttributes::GetPlayer(int id) } else { - LOG(ERROR, "", "CGameAttributes::GetPlayer(): Attempt to get player %d (while there only are %d players)", id, m_Players.size()); + LOG(CLogger::Error, "", "CGameAttributes::GetPlayer(): Attempt to get player %d (while there only are %d players)", id, m_Players.size()); return m_Players[0]; } } @@ -354,7 +354,7 @@ CPlayerSlot *CGameAttributes::GetSlot(int index) return m_PlayerSlots[index]; else { - LOG(ERROR, "", "CGameAttributes::GetSlot(): Attempt to get slot %d (while there only are %d slots)", index, m_PlayerSlots.size()); + LOG(CLogger::Error, "", "CGameAttributes::GetSlot(): Attempt to get slot %d (while there only are %d slots)", index, m_PlayerSlots.size()); return m_PlayerSlots[0]; } } @@ -384,7 +384,7 @@ void CGameAttributes::FinalizeSlots() } else { - LOG(ERROR, "", "CGameAttributes::FinalizeSlots(): slot %d deleted", i); + LOG(CLogger::Error, "", "CGameAttributes::FinalizeSlots(): slot %d deleted", i); delete slot->GetPlayer(); delete slot; } diff --git a/source/ps/GameSetup/Config.cpp b/source/ps/GameSetup/Config.cpp index d8b3471eea..e7d532b4cf 100644 --- a/source/ps/GameSetup/Config.cpp +++ b/source/ps/GameSetup/Config.cpp @@ -94,8 +94,8 @@ static void LoadGlobals() if(gain > 0.0f) WARN_ERR(snd_set_master_gain(gain)); - LOG(NORMAL, LOG_CATEGORY, "g_x/yres is %dx%d", g_xres, g_yres); - LOG(NORMAL, LOG_CATEGORY, "Active profile is %s", g_ActiveProfile.c_str()); + LOG(CLogger::Normal, LOG_CATEGORY, "g_x/yres is %dx%d", g_xres, g_yres); + LOG(CLogger::Normal, LOG_CATEGORY, "Active profile is %s", g_ActiveProfile.c_str()); } diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index a6702dc88b..596c9bf865 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -735,7 +735,7 @@ static void InitSDL() MICROLOG(L"init sdl"); if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE) < 0) { - LOG(ERROR, LOG_CATEGORY, "SDL library initialization failed: %s", SDL_GetError()); + LOG(CLogger::Error, LOG_CATEGORY, "SDL library initialization failed: %s", SDL_GetError()); throw PSERROR_System_SDLInitFailed(); } atexit(SDL_Quit); @@ -963,7 +963,7 @@ void Init(const CmdLineArgs& args, uint flags) MICROLOG(L"SetVideoMode"); if(SetVideoMode(g_xres, g_yres, 32, !windowed) < 0) { - LOG(ERROR, LOG_CATEGORY, "Could not set %dx%d graphics mode: %s", g_xres, g_yres, SDL_GetError()); + LOG(CLogger::Error, LOG_CATEGORY, "Could not set %dx%d graphics mode: %s", g_xres, g_yres, SDL_GetError()); throw PSERROR_System_VmodeFailed(); } diff --git a/source/ps/Hotkey.cpp b/source/ps/Hotkey.cpp index cb3aa874ff..4cbf749b72 100644 --- a/source/ps/Hotkey.cpp +++ b/source/ps/Hotkey.cpp @@ -224,7 +224,7 @@ static void setBindings( const CStr& hotkeyName, int integerMapping = -1 ) if( !mapping ) if( !it->GetInt( mapping ) ) // Attempt decode as key code { - LOG( WARNING, "hotkey", "Couldn't map '%s'", hotkey.c_str() ); + LOG(CLogger::Warning, "hotkey", "Couldn't map '%s'", hotkey.c_str() ); continue; } diff --git a/source/ps/Interact.cpp b/source/ps/Interact.cpp index 5f10801bd5..1831c3df71 100644 --- a/source/ps/Interact.cpp +++ b/source/ps/Interact.cpp @@ -964,7 +964,7 @@ static LibError LoadUnitUIThunk( const VfsPath& pathname, const FileInfo& UNUSED Handle tmp = ogl_tex_load(name.c_str()); if (tmp <= 0) { - LOG(ERROR, LOG_CATEGORY, "Rank Textures", "loadRankTextures failed on \"%s\"", name.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Rank Textures", "loadRankTextures failed on \"%s\"", name.c_str()); return INFO::CB_CONTINUE; } name.Remove("art/textures/ui/session/icons/"); //Names are relative to this directory diff --git a/source/ps/ProfileViewer.cpp b/source/ps/ProfileViewer.cpp index 22dfae1785..ca59f2c78a 100644 --- a/source/ps/ProfileViewer.cpp +++ b/source/ps/ProfileViewer.cpp @@ -420,7 +420,7 @@ void CProfileViewer::SaveToFile() if (m->outputStream.fail()) { - LOG(ERROR, "profiler", "Failed to open profile log file"); + LOG(CLogger::Error, "profiler", "Failed to open profile log file"); return; } } diff --git a/source/ps/World.cpp b/source/ps/World.cpp index 55524e83e4..644eb01c35 100644 --- a/source/ps/World.cpp +++ b/source/ps/World.cpp @@ -82,7 +82,7 @@ void CWorld::Initialize(CGameAttributes *pAttribs) // fails immediately, or registers for delay loading } catch (PSERROR_File&) { delete reader; - LOG(ERROR, LOG_CATEGORY, "Failed to load map %s", mapfilename.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to load map %s", mapfilename.c_str()); throw PSERROR_Game_World_MapLoadFailed(); } } diff --git a/source/ps/XML/XMLUtils.cpp b/source/ps/XML/XMLUtils.cpp index c28f688c86..dfb2422af3 100644 --- a/source/ps/XML/XMLUtils.cpp +++ b/source/ps/XML/XMLUtils.cpp @@ -51,7 +51,7 @@ int CVFSInputSource::OpenFile(const char *path) LibError ret = g_VFS->LoadFile(path, m_pBuffer, m_BufferSize); if(ret != INFO::OK) { - LOG(ERROR, LOG_CATEGORY, "CVFSInputSource: file %s couldn't be loaded (LoadFile: %d)", path, ret); + LOG(CLogger::Error, LOG_CATEGORY, "CVFSInputSource: file %s couldn't be loaded (LoadFile: %d)", path, ret); return -1; } @@ -139,13 +139,13 @@ InputSource *CVFSEntityResolver::resolveEntity(const XMLCh *const UNUSED(publicI } // janwas: removed for less spew -// LOG(NORMAL, LOG_CATEGORY, "EntityResolver: path \"%s\" translated to \"%s\"", orgpath, path); +// LOG(CLogger::Normal, LOG_CATEGORY, "EntityResolver: path \"%s\" translated to \"%s\"", orgpath, path); char *pos=path; if ((pos=strchr(pos, '\\')) != NULL) { - LOG(WARNING, LOG_CATEGORY, "While resolving XML entities for %s: path %s [%s] contains non-portable path separator \\", m_DocName, orgpath, path); + LOG(CLogger::Warning, LOG_CATEGORY, "While resolving XML entities for %s: path %s [%s] contains non-portable path separator \\", m_DocName, orgpath, path); do *pos='/'; while ((pos=strchr(pos+1, '\\')) != NULL); diff --git a/source/ps/XML/XMLWriter.cpp b/source/ps/XML/XMLWriter.cpp index e6700da1c0..15e0d944c2 100644 --- a/source/ps/XML/XMLWriter.cpp +++ b/source/ps/XML/XMLWriter.cpp @@ -72,7 +72,7 @@ bool XMLWriter_File::StoreVFS(const char* filename) LibError ret = g_VFS->CreateFile(filename, data, size); if (ret < 0) { - LOG(ERROR, "xml", "Error saving XML data through VFS: %d", ret); + LOG(CLogger::Error, "xml", "Error saving XML data through VFS: %d", ret); return false; } return true; diff --git a/source/ps/XML/XercesErrorHandler.cpp b/source/ps/XML/XercesErrorHandler.cpp index 32c50c8ef9..3d70895e3b 100644 --- a/source/ps/XML/XercesErrorHandler.cpp +++ b/source/ps/XML/XercesErrorHandler.cpp @@ -26,7 +26,7 @@ void CXercesErrorHandler::warning(const SAXParseException &toCatch) CStr systemId=XMLTranscode(toCatch.getSystemId()); CStr message=XMLTranscode(toCatch.getMessage()); - LOG(WARNING, LOG_CATEGORY, "XML Parse Warning: %s:%d:%d: %s", + LOG(CLogger::Warning, LOG_CATEGORY, "XML Parse Warning: %s:%d:%d: %s", systemId.c_str(), toCatch.getLineNumber(), toCatch.getColumnNumber(), @@ -39,7 +39,7 @@ void CXercesErrorHandler::error(const SAXParseException& toCatch) CStr message=XMLTranscode(toCatch.getMessage()); fSawErrors = true; - LOG(ERROR, LOG_CATEGORY, "XML Parse Error: %s:%d:%d: %s", + LOG(CLogger::Error, LOG_CATEGORY, "XML Parse Error: %s:%d:%d: %s", systemId.c_str(), toCatch.getLineNumber(), toCatch.getColumnNumber(), @@ -52,7 +52,7 @@ void CXercesErrorHandler::fatalError(const SAXParseException& toCatch) CStr message=XMLTranscode(toCatch.getMessage()); fSawErrors = true; - LOG(ERROR, LOG_CATEGORY, "XML Parse Error (Fatal): %s:%d:%d: %s", + LOG(CLogger::Error, LOG_CATEGORY, "XML Parse Error (Fatal): %s:%d:%d: %s", systemId.c_str(), toCatch.getLineNumber(), toCatch.getColumnNumber(), diff --git a/source/ps/XML/Xeromyces.cpp b/source/ps/XML/Xeromyces.cpp index 99f2e5caba..62304e7efd 100644 --- a/source/ps/XML/Xeromyces.cpp +++ b/source/ps/XML/Xeromyces.cpp @@ -133,7 +133,7 @@ PSRETURN CXeromyces::Load(const char* filename) // Make sure the .xml actually exists if (! FileExists(filename)) { - LOG(ERROR, LOG_CATEGORY, "CXeromyces: Failed to find XML file %s", filename); + LOG(CLogger::Error, LOG_CATEGORY, "CXeromyces: Failed to find XML file %s", filename); return PSRETURN_Xeromyces_XMLOpenFailed; } @@ -141,7 +141,7 @@ PSRETURN CXeromyces::Load(const char* filename) FileInfo fileInfo; if (g_VFS->GetFileInfo(filename, &fileInfo) < 0) { - LOG(ERROR, LOG_CATEGORY, "CXeromyces: Failed to stat XML file %s", filename); + LOG(CLogger::Error, LOG_CATEGORY, "CXeromyces: Failed to stat XML file %s", filename); return PSRETURN_Xeromyces_XMLOpenFailed; } @@ -209,7 +209,7 @@ PSRETURN CXeromyces::Load(const char* filename) CVFSInputSource source; if (source.OpenFile(filename) < 0) { - LOG(ERROR, LOG_CATEGORY, "CXeromyces: Failed to open XML file %s", filename); + LOG(CLogger::Error, LOG_CATEGORY, "CXeromyces: Failed to open XML file %s", filename); return PSRETURN_Xeromyces_XMLOpenFailed; } @@ -242,7 +242,7 @@ PSRETURN CXeromyces::Load(const char* filename) if (errorHandler.GetSawErrors()) { - LOG(ERROR, LOG_CATEGORY, "CXeromyces: Errors in XML file '%s'", filename); + LOG(CLogger::Error, LOG_CATEGORY, "CXeromyces: Errors in XML file '%s'", filename); return PSRETURN_Xeromyces_XMLParseError; // The internal tree of the XeroHandler will be cleaned up automatically } diff --git a/source/ps/i18n.cpp b/source/ps/i18n.cpp index 0f9a4526b1..3293a06e58 100644 --- a/source/ps/i18n.cpp +++ b/source/ps/i18n.cpp @@ -53,7 +53,7 @@ bool I18n::LoadLanguage(const char* name) CVFSFile strings; if (! (strings.Load(pathname) == PSRETURN_OK && locale->LoadStrings((const char*)strings.GetBuffer()))) { - LOG(ERROR, LOG_CATEGORY, "Error opening language string file '%s'", pathname); + LOG(CLogger::Error, LOG_CATEGORY, "Error opening language string file '%s'", pathname); return false; } } @@ -67,7 +67,7 @@ bool I18n::LoadLanguage(const char* name) CVFSFile strings; if (! (strings.Load(pathname) == PSRETURN_OK && locale->LoadDictionary((const char*)strings.GetBuffer()))) { - LOG(ERROR, LOG_CATEGORY, "Error opening language string file '%s'", pathname); + LOG(CLogger::Error, LOG_CATEGORY, "Error opening language string file '%s'", pathname); return false; } } @@ -87,7 +87,7 @@ bool I18n::LoadLanguage(const char* name) pathname ))) { - LOG(ERROR, LOG_CATEGORY, "Error opening language function file '%s'", pathname); + LOG(CLogger::Error, LOG_CATEGORY, "Error opening language function file '%s'", pathname); return false; } } diff --git a/source/renderer/ModelRenderer.cpp b/source/renderer/ModelRenderer.cpp index 224ddfbd90..5643b1bdaf 100644 --- a/source/renderer/ModelRenderer.cpp +++ b/source/renderer/ModelRenderer.cpp @@ -68,7 +68,7 @@ void ModelRenderer::BuildPositionAndNormals( // some broken situations if (numVertices && vertices[0].m_Blend.m_Bone[0] == 0xff) { - LOG_ONCE(ERROR, LOG_CATEGORY, "Model %s is boned with unboned animation", mdef->GetName().c_str()); + LOG_ONCE(CLogger::Error, LOG_CATEGORY, "Model %s is boned with unboned animation", mdef->GetName().c_str()); return; } diff --git a/source/renderer/RenderPathVertexShader.cpp b/source/renderer/RenderPathVertexShader.cpp index c413fe8ff6..253931e742 100644 --- a/source/renderer/RenderPathVertexShader.cpp +++ b/source/renderer/RenderPathVertexShader.cpp @@ -63,42 +63,42 @@ bool RenderPathVertexShader::Init() m_ModelLight = ogl_program_load("shaders/model_light.xml"); if (m_ModelLight < 0) { - LOG(WARNING, LOG_CATEGORY, "Failed to load shaders/model_light.xml: %i\n", (int)m_ModelLight); + LOG(CLogger::Warning, LOG_CATEGORY, "Failed to load shaders/model_light.xml: %i\n", (int)m_ModelLight); return false; } m_ModelLightP = ogl_program_load("shaders/model_lightp.xml"); if (m_ModelLightP < 0) { - LOG(WARNING, LOG_CATEGORY, "Failed to load shaders/model_lightp.xml: %i\n", (int)m_ModelLightP); + LOG(CLogger::Warning, LOG_CATEGORY, "Failed to load shaders/model_lightp.xml: %i\n", (int)m_ModelLightP); return false; } m_InstancingLight = ogl_program_load("shaders/instancing_light.xml"); if (m_InstancingLight < 0) { - LOG(WARNING, LOG_CATEGORY, "Failed to load shaders/instancing_light.xml: %i\n", (int)m_InstancingLight); + LOG(CLogger::Warning, LOG_CATEGORY, "Failed to load shaders/instancing_light.xml: %i\n", (int)m_InstancingLight); return false; } m_InstancingLightP = ogl_program_load("shaders/instancing_lightp.xml"); if (m_InstancingLightP < 0) { - LOG(WARNING, LOG_CATEGORY, "Failed to load shaders/instancing_lightp.xml: %i\n", (int)m_InstancingLightP); + LOG(CLogger::Warning, LOG_CATEGORY, "Failed to load shaders/instancing_lightp.xml: %i\n", (int)m_InstancingLightP); return false; } m_Instancing = ogl_program_load("shaders/instancing.xml"); if (m_Instancing < 0) { - LOG(WARNING, LOG_CATEGORY, "Failed to load shaders/instancing.xml: %i\n", (int)m_Instancing); + LOG(CLogger::Warning, LOG_CATEGORY, "Failed to load shaders/instancing.xml: %i\n", (int)m_Instancing); return false; } m_InstancingP = ogl_program_load("shaders/instancingp.xml"); if (m_InstancingP < 0) { - LOG(WARNING, LOG_CATEGORY, "Failed to load shaders/instancingp.xml: %i\n", (int)m_InstancingP); + LOG(CLogger::Warning, LOG_CATEGORY, "Failed to load shaders/instancingp.xml: %i\n", (int)m_InstancingP); return false; } diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index d31850c7a7..f8fa031776 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -535,11 +535,11 @@ bool CRenderer::Open(int width, int height, int depth) GLint bits; glGetIntegerv(GL_DEPTH_BITS,&bits); - LOG(NORMAL, LOG_CATEGORY, "CRenderer::Open: depth bits %d",bits); + LOG(CLogger::Normal, LOG_CATEGORY, "CRenderer::Open: depth bits %d",bits); glGetIntegerv(GL_STENCIL_BITS,&bits); - LOG(NORMAL, LOG_CATEGORY, "CRenderer::Open: stencil bits %d",bits); + LOG(CLogger::Normal, LOG_CATEGORY, "CRenderer::Open: stencil bits %d",bits); glGetIntegerv(GL_ALPHA_BITS,&bits); - LOG(NORMAL, LOG_CATEGORY, "CRenderer::Open: alpha bits %d",bits); + LOG(CLogger::Normal, LOG_CATEGORY, "CRenderer::Open: alpha bits %d",bits); // Validate the currently selected render path SetRenderPath(m_Options.m_RenderPath); @@ -667,7 +667,7 @@ void CRenderer::SetRenderPath(RenderPath rp) { if (!m->CanUseRenderPathVertexShader()) { - LOG(WARNING, LOG_CATEGORY, "Falling back to fixed function\n"); + LOG(CLogger::Warning, LOG_CATEGORY, "Falling back to fixed function\n"); rp = RP_FIXED; } } @@ -695,7 +695,7 @@ CRenderer::RenderPath CRenderer::GetRenderPathByName(const CStr& name) if (name == "default") return RP_DEFAULT; - LOG(WARNING, LOG_CATEGORY, "Unknown render path name '%hs', assuming 'default'", name.c_str()); + LOG(CLogger::Warning, LOG_CATEGORY, "Unknown render path name '%hs', assuming 'default'", name.c_str()); return RP_DEFAULT; } @@ -710,7 +710,7 @@ void CRenderer::SetFastPlayerColor(bool fast) { if (!FastPlayerColorRender::IsAvailable()) { - LOG(WARNING, LOG_CATEGORY, "Falling back to slower player color rendering."); + LOG(CLogger::Warning, LOG_CATEGORY, "Falling back to slower player color rendering."); m_FastPlayerColor = false; } } @@ -1313,7 +1313,7 @@ void CRenderer::EndFrame() static bool once=false; if (!once && glGetError()) { - LOG(ERROR, LOG_CATEGORY, "CRenderer::EndFrame: GL errors occurred"); + LOG(CLogger::Error, LOG_CATEGORY, "CRenderer::EndFrame: GL errors occurred"); once=true; } } @@ -1436,7 +1436,7 @@ bool CRenderer::LoadTexture(CTexture* texture,u32 wrapflags) h = ogl_tex_load(texture->GetName()); if (h <= 0) { - LOG(ERROR, LOG_CATEGORY, "LoadTexture failed on \"%s\"",(const char*) texture->GetName()); + LOG(CLogger::Error, LOG_CATEGORY, "LoadTexture failed on \"%s\"",(const char*) texture->GetName()); texture->SetHandle(errorhandle); return false; } @@ -1449,7 +1449,7 @@ bool CRenderer::LoadTexture(CTexture* texture,u32 wrapflags) // (this also verifies that the texture is a power-of-two) if(ogl_tex_upload(h) < 0) { - LOG(ERROR, LOG_CATEGORY, "LoadTexture failed on \"%s\" : upload failed",(const char*) texture->GetName()); + LOG(CLogger::Error, LOG_CATEGORY, "LoadTexture failed on \"%s\" : upload failed",(const char*) texture->GetName()); ogl_tex_free(h); texture->SetHandle(errorhandle); return false; diff --git a/source/renderer/ShadowMap.cpp b/source/renderer/ShadowMap.cpp index 0d354e9ef8..1772d72ebe 100644 --- a/source/renderer/ShadowMap.cpp +++ b/source/renderer/ShadowMap.cpp @@ -318,7 +318,7 @@ void ShadowMapInternals::CreateTexture() } } - LOG(NORMAL, LOG_CATEGORY, "Creating shadow texture (size %dx%d) (format = %s)%s", + LOG(CLogger::Normal, LOG_CATEGORY, "Creating shadow texture (size %dx%d) (format = %s)%s", Width, Height, formatname, Framebuffer ? " (using EXT_framebuffer_object)" : ""); // create texture object @@ -384,7 +384,7 @@ void ShadowMapInternals::CreateTexture() if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - LOG(WARNING, LOG_CATEGORY, "Framebuffer object incomplete: %04d", status); + LOG(CLogger::Warning, LOG_CATEGORY, "Framebuffer object incomplete: %04d", status); pglDeleteFramebuffersEXT(1, &Framebuffer); Framebuffer = 0; @@ -499,7 +499,7 @@ void ShadowMap::SetUseDepthTexture(bool depthTexture) { if (!g_Renderer.GetCapabilities().m_DepthTextureShadows) { - LOG(WARNING, LOG_CATEGORY, "Depth textures are not supported by your graphics card/driver. Fallback to luminance map (no self-shadowing)!"); + LOG(CLogger::Warning, LOG_CATEGORY, "Depth textures are not supported by your graphics card/driver. Fallback to luminance map (no self-shadowing)!"); depthTexture = false; } } diff --git a/source/renderer/SkyManager.cpp b/source/renderer/SkyManager.cpp index daa2b16a0f..04c9953f1c 100644 --- a/source/renderer/SkyManager.cpp +++ b/source/renderer/SkyManager.cpp @@ -87,7 +87,7 @@ int SkyManager::LoadSkyTextures() Handle ht = ogl_tex_load(filename); if (ht <= 0) { - LOG(ERROR, LOG_CATEGORY, "SkyManager::LoadSkyTextures failed on \"%s\"", filename); + LOG(CLogger::Error, LOG_CATEGORY, "SkyManager::LoadSkyTextures failed on \"%s\"", filename); return ht; } ogl_tex_set_wrap(ht, GL_CLAMP_TO_EDGE); @@ -132,7 +132,7 @@ void SkyManager::SetSkySet( const CStrW& newSet ) Handle ht = ogl_tex_load(filename); if (ht <= 0) { - LOG(ERROR, LOG_CATEGORY, "SkyManager::SetSkySet failed on \"%s\"", filename); + LOG(CLogger::Error, LOG_CATEGORY, "SkyManager::SetSkySet failed on \"%s\"", filename); return; } ogl_tex_set_wrap(ht, GL_CLAMP_TO_EDGE); @@ -154,7 +154,7 @@ std::vector SkyManager::GetSkySets() const DirectoryNames subdirectories; if(g_VFS->GetDirectoryEntries(dirname, 0, &subdirectories) < 0) { - LOG(ERROR, "vfs", "Error opening directory '%s'", dirname); + LOG(CLogger::Error, "vfs", "Error opening directory '%s'", dirname); return std::vector(1, GetSkySet()); // just return what we currently have } diff --git a/source/renderer/VertexBufferManager.cpp b/source/renderer/VertexBufferManager.cpp index 4e958c6034..1d8cee983a 100644 --- a/source/renderer/VertexBufferManager.cpp +++ b/source/renderer/VertexBufferManager.cpp @@ -61,7 +61,7 @@ CVertexBuffer::VBChunk* CVertexBufferManager::Allocate(size_t vertexSize, size_t if (!result) { - LOG(ERROR, LOG_CATEGORY, "Failed to create VBOs (%d*%d)", vertexSize, numVertices); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to create VBOs (%d*%d)", vertexSize, numVertices); } return result; diff --git a/source/renderer/WaterManager.cpp b/source/renderer/WaterManager.cpp index f3a9dc97d2..3983c482c9 100644 --- a/source/renderer/WaterManager.cpp +++ b/source/renderer/WaterManager.cpp @@ -101,7 +101,7 @@ int WaterManager::LoadWaterTextures() Handle ht = ogl_tex_load(filename); if (ht <= 0) { - LOG(ERROR, LOG_CATEGORY, "LoadWaterTextures failed on \"%s\"", filename); + LOG(CLogger::Error, LOG_CATEGORY, "LoadWaterTextures failed on \"%s\"", filename); return ht; } m_WaterTexture[cur_loading_water_tex] = ht; @@ -118,7 +118,7 @@ int WaterManager::LoadWaterTextures() Handle ht = ogl_tex_load(filename); if (ht <= 0) { - LOG(ERROR, LOG_CATEGORY, "LoadWaterTextures failed on \"%s\"", filename); + LOG(CLogger::Error, LOG_CATEGORY, "LoadWaterTextures failed on \"%s\"", filename); return ht; } m_NormalMap[cur_loading_normal_map] = ht; diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index 8e68fb04d5..c582a178d2 100644 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -99,7 +99,7 @@ JSBool WriteLog(JSContext* cx, JSObject*, uint argc, jsval* argv, jsval* rval) // We should perhaps unicodify (?) the logger at some point. - LOG( NORMAL, "script", logMessage ); + LOG(CLogger::Normal, "script", logMessage ); *rval = JSVAL_TRUE; return JS_TRUE; @@ -935,26 +935,19 @@ JSBool ExitProgram( JSContext* cx, JSObject*, uint argc, jsval* argv, jsval* rva } -// Write an indication of total/available video RAM to console. +// Write an indication of total video RAM to console. // params: // returns: // notes: -// - Not supported on all platforms. +// - May not be supported on all platforms. // - Only a rough approximation; do not base low-level decisions // ("should I allocate one more texture?") on this. JSBool WriteVideoMemToConsole( JSContext* cx, JSObject*, uint argc, jsval* argv, jsval* rval ) { JSU_REQUIRE_NO_PARAMS(); -#if OS_WIN - int left, total; - if (GetVRAMInfo(left, total)) - g_Console->InsertMessage(L"VRAM: used %d, total %d, free %d", total-left, total, left); - else - g_Console->InsertMessage(L"VRAM: failed to detect"); -#else - g_Console->InsertMessage(L"VRAM: [not available on non-Windows]"); -#endif + SDL_VideoInfo* videoInfo = SDL_GetVideoInfo(); + g_Console->InsertMessage(L"VRAM: total %d", videoInfo->video_mem); return JS_TRUE; } @@ -1597,23 +1590,19 @@ enum ScriptGlobalTinyIDs GLOBAL_LIGHTENV }; -// shorthand -#define PERM JSPROP_PERMANENT -#define CONST JSPROP_READONLY - JSPropertySpec ScriptGlobalTable[] = { - { "selection" , GLOBAL_SELECTION, PERM, JSI_Selection::getSelection, JSI_Selection::SetSelection }, - { "groups" , GLOBAL_GROUPSARRAY, PERM, JSI_Selection::getGroups, JSI_Selection::setGroups }, - { "camera" , GLOBAL_CAMERA, PERM, JSI_Camera::getCamera, JSI_Camera::setCamera }, - { "console" , GLOBAL_CONSOLE, PERM | CONST, JSI_Console::getConsole, 0 }, - { "lightenv" , GLOBAL_LIGHTENV, PERM, JSI_LightEnv::getLightEnv, JSI_LightEnv::setLightEnv }, - { "entities" , 0, PERM | CONST, GetEntitySet, 0 }, - { "players" , 0, PERM | CONST, GetPlayerSet, 0 }, - { "localPlayer", 0, PERM , GetLocalPlayer, SetLocalPlayer }, - { "gaiaPlayer" , 0, PERM | CONST, GetGaiaPlayer, 0 }, - { "gameView" , 0, PERM | CONST, GetGameView, 0 }, - { "renderer" , 0, PERM | CONST, GetRenderer, 0 }, + { "selection" , GLOBAL_SELECTION, JSPROP_PERMANENT, JSI_Selection::getSelection, JSI_Selection::SetSelection }, + { "groups" , GLOBAL_GROUPSARRAY, JSPROP_PERMANENT, JSI_Selection::getGroups, JSI_Selection::setGroups }, + { "camera" , GLOBAL_CAMERA, JSPROP_PERMANENT, JSI_Camera::getCamera, JSI_Camera::setCamera }, + { "console" , GLOBAL_CONSOLE, JSPROP_PERMANENT|JSPROP_READONLY, JSI_Console::getConsole, 0 }, + { "lightenv" , GLOBAL_LIGHTENV, JSPROP_PERMANENT, JSI_LightEnv::getLightEnv, JSI_LightEnv::setLightEnv }, + { "entities" , 0, JSPROP_PERMANENT|JSPROP_READONLY, GetEntitySet, 0 }, + { "players" , 0, JSPROP_PERMANENT|JSPROP_READONLY, GetPlayerSet, 0 }, + { "localPlayer", 0, JSPROP_PERMANENT, GetLocalPlayer, SetLocalPlayer }, + { "gaiaPlayer" , 0, JSPROP_PERMANENT|JSPROP_READONLY, GetGaiaPlayer, 0 }, + { "gameView" , 0, JSPROP_PERMANENT|JSPROP_READONLY, GetGameView, 0 }, + { "renderer" , 0, JSPROP_PERMANENT|JSPROP_READONLY, GetRenderer, 0 }, // end of table marker { 0, 0, 0, 0, 0 }, diff --git a/source/scripting/ScriptingHost.cpp b/source/scripting/ScriptingHost.cpp index e58ed38259..c5c0f739dd 100644 --- a/source/scripting/ScriptingHost.cpp +++ b/source/scripting/ScriptingHost.cpp @@ -405,7 +405,7 @@ void ScriptingHost::ErrorReporter(JSContext* UNUSED(cx), const char* message, JS // note: CLogger's LOG already takes care of writing to the console, // so don't do that here. - LOG(ERROR, LOG_CATEGORY, "JavaScript Error (%s, line %d): %s", file, line, message); + LOG(CLogger::Error, LOG_CATEGORY, "JavaScript Error (%s, line %d): %s", file, line, message); } #ifndef NDEBUG diff --git a/source/simulation/EntityTemplate.cpp b/source/simulation/EntityTemplate.cpp index a43cbaa852..f158f19dce 100644 --- a/source/simulation/EntityTemplate.cpp +++ b/source/simulation/EntityTemplate.cpp @@ -170,7 +170,7 @@ bool CEntityTemplate::LoadXml( const CStr& filename ) if( Root.GetNodeName() != el_Entity ) { - LOG( ERROR, LOG_CATEGORY, "CEntityTemplate::LoadXml: XML root was not \"Entity\" in file %s. Load failed.", filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CEntityTemplate::LoadXml: XML root was not \"Entity\" in file %s. Load failed.", filename.c_str() ); return( false ); } @@ -191,7 +191,7 @@ bool CEntityTemplate::LoadXml( const CStr& filename ) } else { - LOG( WARNING, LOG_CATEGORY, "Parent template \"%ls\" does not exist in template \"%ls\"", m_Base_Name.c_str(), m_Tag.c_str() ); + LOG(CLogger::Warning, LOG_CATEGORY, "Parent template \"%ls\" does not exist in template \"%ls\"", m_Base_Name.c_str(), m_Tag.c_str() ); // (The requested entity will still be returned, but with no parent. // Is this a reasonable thing to do?) } @@ -299,7 +299,7 @@ bool CEntityTemplate::LoadXml( const CStr& filename ) JSFunction* fn = JS_ValueToFunction( g_ScriptingHost.GetContext(), fnval ); if( !fn ) { - LOG( ERROR, LOG_CATEGORY, "CEntityTemplate::LoadXml: Function does not exist for event %hs in file %s. Load failed.", EventName.c_str(), filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CEntityTemplate::LoadXml: Function does not exist for event %hs in file %s. Load failed.", EventName.c_str(), filename.c_str() ); break; } m_EventHandlers[eventID].SetFunction( fn ); @@ -351,7 +351,7 @@ void CEntityTemplate::XMLLoadProperty( const CXeromyces& XeroFile, const XMBElem if( Existing ) { if( !Existing->m_Intrinsic ) - LOG( WARNING, LOG_CATEGORY, "CEntityTemplate::XMLAddProperty: %ls already defined for %ls. Property trees will be merged.", PropertyName.c_str(), m_Tag.c_str() ); + LOG(CLogger::Warning, LOG_CATEGORY, "CEntityTemplate::XMLAddProperty: %ls already defined for %ls. Property trees will be merged.", PropertyName.c_str(), m_Tag.c_str() ); Existing->Set( this, JSParseString( Source.GetText() ) ); //Existing->m_Inherited = false; } diff --git a/source/simulation/EntityTemplateCollection.cpp b/source/simulation/EntityTemplateCollection.cpp index 21d38d690e..2305146008 100644 --- a/source/simulation/EntityTemplateCollection.cpp +++ b/source/simulation/EntityTemplateCollection.cpp @@ -73,12 +73,12 @@ CEntityTemplate* CEntityTemplateCollection::GetTemplate( const CStrW& name, CPla CEntityTemplate* newTemplate = new CEntityTemplate( player ); if( !newTemplate->LoadXml( path ) ) { - LOG(ERROR, LOG_CATEGORY, "CEntityTemplateCollection::GetTemplate(): Couldn't load template \"%s\"", path.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "CEntityTemplateCollection::GetTemplate(): Couldn't load template \"%s\"", path.c_str()); delete newTemplate; return( NULL ); } - LOG(NORMAL, LOG_CATEGORY, "CEntityTemplateCollection::GetTemplate(): Loaded template \"%s\"", path.c_str()); + LOG(CLogger::Normal, LOG_CATEGORY, "CEntityTemplateCollection::GetTemplate(): Loaded template \"%s\"", path.c_str()); m_templates[id][name] = newTemplate; return newTemplate; diff --git a/source/simulation/Formation.cpp b/source/simulation/Formation.cpp index ef25915831..dc69a996b0 100644 --- a/source/simulation/Formation.cpp +++ b/source/simulation/Formation.cpp @@ -52,7 +52,7 @@ bool CFormation::LoadXml(const CStr& filename) XMBElement Root = XeroFile.GetRoot(); if( Root.GetNodeName() != el_formation ) { - LOG( ERROR, LOG_CATEGORY, "CFormation::LoadXml: XML root was not \"Formation\" in file %s. Load failed.", filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CFormation::LoadXml: XML root was not \"Formation\" in file %s. Load failed.", filename.c_str() ); return( false ); } @@ -104,7 +104,7 @@ bool CFormation::LoadXml(const CStr& filename) else { const char* invAttr = XeroFile.GetAttributeString(Attr.Name).c_str(); - LOG( ERROR, LOG_CATEGORY, "CFormation::LoadXml: Invalid attribute %s defined in formation file %s. Load failed.", invAttr, filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CFormation::LoadXml: Invalid attribute %s defined in formation file %s. Load failed.", invAttr, filename.c_str() ); return( false ); } } @@ -147,7 +147,7 @@ bool CFormation::LoadXml(const CStr& filename) if( order <= 0 ) { - LOG( ERROR, LOG_CATEGORY, "CFormation::LoadXml: Invalid (negative number or 0) order defined in formation file %s. The game will try to continue anyway.", filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CFormation::LoadXml: Invalid (negative number or 0) order defined in formation file %s. The game will try to continue anyway.", filename.c_str() ); continue; } --order; //We need this to be in line with arrays, so start at 0 @@ -179,7 +179,7 @@ bool CFormation::LoadXml(const CStr& filename) { if ( m_slots.find(i) == m_slots.end() ) { - LOG( ERROR, LOG_CATEGORY, "CFormation::LoadXml: Missing orders in %s. Load failed.", filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CFormation::LoadXml: Missing orders in %s. Load failed.", filename.c_str() ); return false; } else diff --git a/source/simulation/FormationCollection.cpp b/source/simulation/FormationCollection.cpp index 3aebe56c31..7126bf0d08 100644 --- a/source/simulation/FormationCollection.cpp +++ b/source/simulation/FormationCollection.cpp @@ -50,12 +50,12 @@ CFormation* CFormationCollection::GetTemplate( const CStrW& name ) CFormation* newTemplate = new CFormation(); if( !newTemplate->LoadXml( path ) ) { - LOG(ERROR, LOG_CATEGORY, "CFormationCollection::LoadTemplates(): Couldn't load template \"%s\"", path.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "CFormationCollection::LoadTemplates(): Couldn't load template \"%s\"", path.c_str()); delete newTemplate; return( NULL ); } - LOG(NORMAL, LOG_CATEGORY, "CFormationCollection::LoadTemplates(): Loaded template \"%s\"", path.c_str()); + LOG(CLogger::Normal, LOG_CATEGORY, "CFormationCollection::LoadTemplates(): Loaded template \"%s\"", path.c_str()); m_templates[name] = newTemplate; return newTemplate; diff --git a/source/simulation/Simulation.cpp b/source/simulation/Simulation.cpp index cecfbce690..9690395ee0 100644 --- a/source/simulation/Simulation.cpp +++ b/source/simulation/Simulation.cpp @@ -348,7 +348,7 @@ uint CSimulation::TranslateMessage(CNetMessage* pMsg, uint clientMask, void* UNU } if (order.m_type == CEntityOrder::ORDER_LAST) { - LOG(ERROR, "simulation", "Got an AddWaypoint message for an entity that isn't moving."); + LOG(CLogger::Error, "simulation", "Got an AddWaypoint message for an entity that isn't moving."); } } break; diff --git a/source/simulation/Technology.cpp b/source/simulation/Technology.cpp index 3e21a9917e..fd113e6cef 100644 --- a/source/simulation/Technology.cpp +++ b/source/simulation/Technology.cpp @@ -46,7 +46,7 @@ bool CTechnology::LoadXml( const CStr& filename ) XMBElement Root = XeroFile.GetRoot(); if ( Root.GetNodeName() != el_tech ) { - LOG( ERROR, LOG_CATEGORY, "CTechnology: XML root was not \"Tech\" in file %s. Load failed.", filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology: XML root was not \"Tech\" in file %s. Load failed.", filename.c_str() ); return false; } XMBElementList RootChildren = Root.GetChildNodes(); @@ -65,7 +65,7 @@ bool CTechnology::LoadXml( const CStr& filename ) continue; if ( !ret ) { - LOG( ERROR, LOG_CATEGORY, "CTechnology: Load failed for file %s", filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology: Load failed for file %s", filename.c_str() ); return false; } } @@ -111,7 +111,7 @@ bool CTechnology::LoadElId( XMBElement ID, CXeromyces& XeroFile ) else { const char* tagName = XeroFile.GetElementString(name).c_str(); - LOG( ERROR, LOG_CATEGORY, "CTechnology: invalid tag %s for XML file", tagName ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology: invalid tag %s for XML file", tagName ); return false; } } @@ -162,7 +162,7 @@ bool CTechnology::LoadElReq( XMBElement Req, CXeromyces& XeroFile ) else { const char* tagName = XeroFile.GetElementString(name).c_str(); - LOG( ERROR, LOG_CATEGORY, "CTechnology: invalid tag %s for XML file", tagName ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology: invalid tag %s for XML file", tagName ); return false; } } @@ -214,7 +214,7 @@ bool CTechnology::LoadElEffect( XMBElement effect, CXeromyces& XeroFile, const C { if( modValue.size() == 0) { - LOG( ERROR, LOG_CATEGORY, "CTechnology::LoadXml: invalid Modifier value (empty string)" ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology::LoadXml: invalid Modifier value (empty string)" ); m_Modifiers.pop_back(); return false; } @@ -228,7 +228,7 @@ bool CTechnology::LoadElEffect( XMBElement effect, CXeromyces& XeroFile, const C } else { - LOG( ERROR, LOG_CATEGORY, "CTechnology::LoadXml: invalid tag inside \"Modifier\" tag" ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology::LoadXml: invalid tag inside \"Modifier\" tag" ); m_Modifiers.pop_back(); return false; } @@ -249,7 +249,7 @@ bool CTechnology::LoadElEffect( XMBElement effect, CXeromyces& XeroFile, const C m_Sets.back().value = setValue.ToFloat(); else { - LOG( ERROR, LOG_CATEGORY, "CTechnology::LoadXml: invalid tag inside \"Set\" tag" ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology::LoadXml: invalid tag inside \"Set\" tag" ); m_Sets.pop_back(); return false; } @@ -282,7 +282,7 @@ bool CTechnology::LoadElEffect( XMBElement effect, CXeromyces& XeroFile, const C JSFunction* fn = JS_ValueToFunction( g_ScriptingHost.GetContext(), fnval ); if( !fn ) { - LOG( ERROR, LOG_CATEGORY, "CTechnology::LoadXml: Function does not exist for %hs in file %s. Load failed.", funcName.c_str(), filename.c_str() ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology::LoadXml: Function does not exist for %hs in file %s. Load failed.", funcName.c_str(), filename.c_str() ); return false; } m_effectFunction.SetFunction( fn ); @@ -294,7 +294,7 @@ bool CTechnology::LoadElEffect( XMBElement effect, CXeromyces& XeroFile, const C else { const char* tagName = XeroFile.GetElementString(name).c_str(); - LOG( ERROR, LOG_CATEGORY, "CTechnology: invalid tag %s for XML file", tagName ); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnology: invalid tag %s for XML file", tagName ); return false; } } diff --git a/source/simulation/TechnologyCollection.cpp b/source/simulation/TechnologyCollection.cpp index 1f4ad362d3..1a8bafe2a4 100644 --- a/source/simulation/TechnologyCollection.cpp +++ b/source/simulation/TechnologyCollection.cpp @@ -49,14 +49,14 @@ CTechnology* CTechnologyCollection::GetTechnology( const CStrW& name, CPlayer* p CTechnology* newTemplate = new CTechnology( name, player ); if( !newTemplate->LoadXml( path ) ) { - LOG(ERROR, LOG_CATEGORY, "CTechnologyCollection::GetTechnology(): Couldn't load tech \"%s\"", path.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "CTechnologyCollection::GetTechnology(): Couldn't load tech \"%s\"", path.c_str()); delete newTemplate; return( NULL ); } m_techs[id][name] = newTemplate; - LOG(NORMAL, LOG_CATEGORY, "CTechnologyCollection::GetTechnology(): Loaded tech \"%s\"", path.c_str()); + LOG(CLogger::Normal, LOG_CATEGORY, "CTechnologyCollection::GetTechnology(): Loaded tech \"%s\"", path.c_str()); return newTemplate; } diff --git a/source/simulation/TriggerManager.cpp b/source/simulation/TriggerManager.cpp index 3ded635ea5..2d76ef0cae 100644 --- a/source/simulation/TriggerManager.cpp +++ b/source/simulation/TriggerManager.cpp @@ -355,7 +355,7 @@ bool CTriggerManager::LoadXml( const CStr& filename ) { if ( !LoadTriggerSpec(rootChild, XeroFile, true) ) { - LOG(ERROR, LOG_CATEGORY, "Error detected in Trigger XML tag. File: %s", filename.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Error detected in Trigger XML tag. File: %s", filename.c_str()); return false; } } @@ -363,13 +363,13 @@ bool CTriggerManager::LoadXml( const CStr& filename ) { if ( !LoadTriggerSpec(rootChild, XeroFile, false) ) { - LOG(ERROR, LOG_CATEGORY, "Error detected in Trigger XML tag. File: %s", filename.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Error detected in Trigger XML tag. File: %s", filename.c_str()); return false; } } else { - LOG(ERROR, LOG_CATEGORY, "Invalid tag in trigger XML. File: %s", filename.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Invalid tag in trigger XML. File: %s", filename.c_str()); return false; } } diff --git a/source/sound/CMusicPlayer.cpp b/source/sound/CMusicPlayer.cpp index 6a8d26a71a..d25241a16a 100644 --- a/source/sound/CMusicPlayer.cpp +++ b/source/sound/CMusicPlayer.cpp @@ -42,11 +42,11 @@ void CMusicPlayer::Open(char* UNUSED(filename)) size_t sizeOfFile; if(vfs_load(filename, p, sizeOfFile) != INFO::OK) { - LOG(ERROR, LOG_CATEGORY, "CMusicPlayer::open(): vfs_load for %s failed!\n", filename); + LOG(CLogger::Error, LOG_CATEGORY, "CMusicPlayer::open(): vfs_load for %s failed!\n", filename); return; } else - LOG(NORMAL, LOG_CATEGORY, "CMusicPlayer::open(): file %s loaded successfully\n", filename); + LOG(CLogger::Normal, LOG_CATEGORY, "CMusicPlayer::open(): file %s loaded successfully\n", filename); memFile.dataPtr = (char*)p; memFile.dataRead = 0; memFile.dataSize = sizeOfFile; @@ -216,7 +216,7 @@ void CMusicPlayer::Check() if(error != AL_NO_ERROR) { std::string str = errorString(error); - LOG(ERROR, LOG_CATEGORY, "OpenAL error: %s\n", str.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "OpenAL error: %s\n", str.c_str()); } */ } diff --git a/source/sound/SoundGroup.cpp b/source/sound/SoundGroup.cpp index 3cbeeeb643..5dc267891c 100644 --- a/source/sound/SoundGroup.cpp +++ b/source/sound/SoundGroup.cpp @@ -206,7 +206,7 @@ bool CSoundGroup::LoadSoundGroup(const char *XMLfile) if (root.GetNodeName() != el_soundgroup) { - LOG(ERROR, LOG_CATEGORY, "Invalid SoundGroup format (unrecognised root element '%s')", XeroFile.GetElementString(root.GetNodeName()).c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Invalid SoundGroup format (unrecognised root element '%s')", XeroFile.GetElementString(root.GetNodeName()).c_str()); return false; } diff --git a/source/tools/atlas/GameInterface/GameLoop.cpp b/source/tools/atlas/GameInterface/GameLoop.cpp index 7a4802cdb3..4d83180bae 100644 --- a/source/tools/atlas/GameInterface/GameLoop.cpp +++ b/source/tools/atlas/GameInterface/GameLoop.cpp @@ -168,7 +168,7 @@ bool BeginAtlas(const CmdLineArgs& args, const DllLoader& dll) debug_warn("Unrecognised message"); // CLogger might not be initialised, but this error will be sent // to the debug output window anyway so people can still see it - LOG(ERROR, "atlas", "Unrecognised message (%s)", name.c_str()); + LOG(CLogger::Error, "atlas", "Unrecognised message (%s)", name.c_str()); } if (msg->GetType() == IMessage::Query) diff --git a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp index e5044113f4..a5bd46379c 100644 --- a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp @@ -426,20 +426,20 @@ BEGIN_COMMAND(CreateObject) { CEntityTemplate* base = g_EntityTemplateCollection.GetTemplate(name); if (! base) - LOG(ERROR, LOG_CATEGORY, "Failed to load entity template '%ls'", name.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to load entity template '%ls'", name.c_str()); else { HEntity ent = g_EntityManager.Create(base, m_Pos, m_Angle, selections); if (! ent) { - LOG(ERROR, LOG_CATEGORY, "Failed to create entity of type '%ls'", name.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to create entity of type '%ls'", name.c_str()); } else if (! ent->m_actor) { // We don't want to allow entities with no actors, because // they'll be be invisible and will confuse scenario designers - LOG(ERROR, LOG_CATEGORY, "Failed to create entity of type '%ls'", name.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to create entity of type '%ls'", name.c_str()); ent->Kill(); } else @@ -459,7 +459,7 @@ BEGIN_COMMAND(CreateObject) CUnit* unit = GetUnitManager().CreateUnit(CStr(name), NULL, selections); if (! unit) { - LOG(ERROR, LOG_CATEGORY, "Failed to load nonentity actor '%ls'", name.c_str()); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to load nonentity actor '%ls'", name.c_str()); } else {