Use new logging system for components

pull/540/head
Andrei Kortunov 6 years ago
parent 9a5b016293
commit 1452684d9e

@ -14,7 +14,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <sys/ptrace.h> #include <sys/ptrace.h>
#include <iostream> #include <components/debug/debuglog.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
@ -185,7 +185,7 @@ static void gdb_info(pid_t pid)
if (close(fd) == 0) if (close(fd) == 0)
remove(respfile); remove(respfile);
else else
std::cerr << "Warning: can not close and remove file '" << respfile << "': " << std::strerror(errno) << std::endl; Log(Debug::Warning) << "Warning: can not close and remove file '" << respfile << "': " << std::strerror(errno);
} }
printf("!!! Could not create gdb command file\n"); printf("!!! Could not create gdb command file\n");
} }
@ -517,8 +517,9 @@ void crashCatcherInstall(int argc, char **argv, const std::string &crashLogPath)
int s[5] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGABRT }; int s[5] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGABRT };
if (crashCatcherInstallHandlers(argc, argv, 5, s, crashLogPath.c_str(), NULL) == -1) if (crashCatcherInstallHandlers(argc, argv, 5, s, crashLogPath.c_str(), NULL) == -1)
{ {
std::cerr << "Installing crash handler failed" << std::endl; Log(Debug::Warning) << "Installing crash handler failed";
} else }
std::cout << "Crash handler installed" << std::endl; else
Log(Debug::Info) << "Crash handler installed";
} }
} }

@ -2,7 +2,6 @@
#define DEBUG_LOG_H #define DEBUG_LOG_H
#include <mutex> #include <mutex>
#include <sstream>
#include <iostream> #include <iostream>
namespace Debug namespace Debug

@ -1,6 +1,6 @@
#include "cellref.hpp" #include "cellref.hpp"
#include <iostream> #include <components/debug/debuglog.hpp>
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
@ -48,9 +48,7 @@ void ESM::CellRef::loadId (ESMReader& esm, bool wideRefNum)
mRefID = esm.getHNOString ("NAME"); mRefID = esm.getHNOString ("NAME");
if (mRefID.empty()) if (mRefID.empty())
{ {
std::ios::fmtflags f(std::cerr.flags()); Log(Debug::Warning) << "Warning: got CellRef with empty RefId in " << esm.getName() << " 0x" << std::hex << esm.getFileOffset();
std::cerr << "Warning: got CellRef with empty RefId in " << esm.getName() << " 0x" << std::hex << esm.getFileOffset() << std::endl;
std::cerr.flags(f);
} }
} }

@ -1,6 +1,6 @@
#include "loadcrea.hpp" #include "loadcrea.hpp"
#include <iostream> #include <components/debug/debuglog.hpp>
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
@ -89,7 +89,7 @@ namespace ESM {
// seems to occur only in .ESS files, unsure of purpose // seems to occur only in .ESS files, unsure of purpose
int index; int index;
esm.getHT(index); esm.getHT(index);
std::cerr << "Creature::load: Unhandled INDX " << index << std::endl; Log(Debug::Warning) << "Creature::load: Unhandled INDX " << index;
break; break;
default: default:
esm.fail("Unknown subrecord"); esm.fail("Unknown subrecord");

@ -1,6 +1,6 @@
#include "loaddial.hpp" #include "loaddial.hpp"
#include <iostream> #include <components/debug/debuglog.hpp>
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
@ -128,7 +128,7 @@ namespace ESM
return; return;
} }
std::cerr << "Warning: Failed to insert info " << info.mId << std::endl; Log(Debug::Warning) << "Warning: Failed to insert info " << info.mId;
} }
void Dialogue::clearDeletedInfos() void Dialogue::clearDeletedInfos()

@ -1,11 +1,11 @@
#include "loadscpt.hpp" #include "loadscpt.hpp"
#include <components/debug/debuglog.hpp>
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
#include "defs.hpp" #include "defs.hpp"
#include <iostream>
namespace ESM namespace ESM
{ {
unsigned int Script::sRecordId = REC_SCPT; unsigned int Script::sRecordId = REC_SCPT;
@ -45,12 +45,12 @@ namespace ESM
// an exeption, just log an error and continue. // an exeption, just log an error and continue.
std::stringstream ss; std::stringstream ss;
ss << "ESM Error: " << "String table overflow"; ss << "String table overflow";
ss << "\n File: " << esm.getName(); ss << "\n File: " << esm.getName();
ss << "\n Record: " << esm.getContext().recName.toString(); ss << "\n Record: " << esm.getContext().recName.toString();
ss << "\n Subrecord: " << "SCVR"; ss << "\n Subrecord: " << "SCVR";
ss << "\n Offset: 0x" << std::hex << esm.getFileOffset(); ss << "\n Offset: 0x" << std::hex << esm.getFileOffset();
std::cerr << ss.str() << std::endl; Log(Debug::Verbose) << ss.str();
break; break;
} }
@ -91,10 +91,10 @@ namespace ESM
if (subSize != static_cast<uint32_t>(mData.mScriptDataSize)) if (subSize != static_cast<uint32_t>(mData.mScriptDataSize))
{ {
std::stringstream ss; std::stringstream ss;
ss << "ESM Warning: Script data size defined in SCHD subrecord does not match size of SCDT subrecord"; ss << "Script data size defined in SCHD subrecord does not match size of SCDT subrecord";
ss << "\n File: " << esm.getName(); ss << "\n File: " << esm.getName();
ss << "\n Offset: 0x" << std::hex << esm.getFileOffset(); ss << "\n Offset: 0x" << std::hex << esm.getFileOffset();
std::cerr << ss.str() << std::endl; Log(Debug::Verbose) << ss.str();
} }
mScriptData.resize(subSize); mScriptData.resize(subSize);

@ -10,6 +10,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <components/debug/debuglog.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
@ -378,7 +379,7 @@ namespace ESMTerrain
const ESM::LandTexture* ltex = getLandTexture(id.first-1, id.second); const ESM::LandTexture* ltex = getLandTexture(id.first-1, id.second);
if (!ltex) if (!ltex)
{ {
std::cerr << "Warning: Unable to find land texture index " << id.first-1 << " in plugin " << id.second << ", using default texture instead" << std::endl; Log(Debug::Warning) << "Warning: Unable to find land texture index " << id.first-1 << " in plugin " << id.second << ", using default texture instead";
return defaultTexture; return defaultTexture;
} }

@ -1,7 +1,6 @@
#include "configurationmanager.hpp" #include "configurationmanager.hpp"
#include <iostream> #include <components/debug/debuglog.hpp>
#include <components/files/escape.hpp> #include <components/files/escape.hpp>
#include <boost/algorithm/string/erase.hpp> #include <boost/algorithm/string/erase.hpp>
@ -134,7 +133,7 @@ bool ConfigurationManager::loadConfig(const boost::filesystem::path& path,
if (boost::filesystem::is_regular_file(cfgFile)) if (boost::filesystem::is_regular_file(cfgFile))
{ {
if (!mSilent) if (!mSilent)
std::cout << "Loading config file: " << cfgFile.string() << "... "; Log(Debug::Info) << "Loading config file: " << cfgFile.string() << "... ";
boost::filesystem::ifstream configFileStreamUnfiltered(cfgFile); boost::filesystem::ifstream configFileStreamUnfiltered(cfgFile);
boost::iostreams::filtering_istream configFileStream; boost::iostreams::filtering_istream configFileStream;
@ -146,13 +145,13 @@ bool ConfigurationManager::loadConfig(const boost::filesystem::path& path,
configFileStream, description, true), variables); configFileStream, description, true), variables);
if (!mSilent) if (!mSilent)
std::cout << "done." << std::endl; Log(Debug::Info) << "done.";
return true; return true;
} }
else else
{ {
if (!mSilent) if (!mSilent)
std::cout << "failed." << std::endl; Log(Debug::Info) << "failed.";
return false; return false;
} }
} }

@ -1,9 +1,9 @@
#include "multidircollection.hpp" #include "multidircollection.hpp"
#include <iostream>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <components/debug/debuglog.hpp>
namespace Files namespace Files
{ {
struct NameEqual struct NameEqual
@ -46,7 +46,7 @@ namespace Files
{ {
if (!boost::filesystem::is_directory(*iter)) if (!boost::filesystem::is_directory(*iter))
{ {
std::cout << "Skipping invalid directory: " << (*iter).string() << std::endl; Log(Debug::Info) << "Skipping invalid directory: " << (*iter).string();
continue; continue;
} }

@ -14,6 +14,8 @@
#include <MyGUI_FactoryManager.h> #include <MyGUI_FactoryManager.h>
#include <MyGUI_RenderManager.h> #include <MyGUI_RenderManager.h>
#include <components/debug/debuglog.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
@ -281,7 +283,7 @@ namespace Gui
assert (image->isDataContiguous()); assert (image->isDataContiguous());
memcpy(image->data(), &textureData[0], textureData.size()); memcpy(image->data(), &textureData[0], textureData.size());
std::cout << "Writing " << resourceName + ".png" << std::endl; Log(Debug::Info) << "Writing " << resourceName + ".png";
osgDB::writeImageFile(*image, resourceName + ".png"); osgDB::writeImageFile(*image, resourceName + ".png");
} }
@ -461,7 +463,7 @@ namespace Gui
if (exportToFile) if (exportToFile)
{ {
std::cout << "Writing " << resourceName + ".xml" << std::endl; Log(Debug::Info) << "Writing " << resourceName + ".xml";
xmlDocument.createDeclaration(); xmlDocument.createDeclaration();
xmlDocument.save(resourceName + ".xml"); xmlDocument.save(resourceName + ".xml");
} }

@ -3,8 +3,8 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <iostream>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
namespace Interpreter{ namespace Interpreter{
@ -191,8 +191,8 @@ namespace Interpreter{
} }
catch (std::exception& e) catch (std::exception& e)
{ {
std::cerr << "Error: Failed to replace escape character, with the following error: " << e.what() << std::endl; Log(Debug::Error) << "Error: Failed to replace escape character, with the following error: " << e.what();
std::cerr << "Full text below: " << std::endl << text << std::endl; Log(Debug::Error) << "Full text below:\n" << text;
} }
// Not found, or error // Not found, or error

@ -5,7 +5,7 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
#include <iostream> #include <components/debug/debuglog.hpp>
namespace osgMyGUI namespace osgMyGUI
{ {
@ -23,7 +23,7 @@ MyGUI::IDataStream *DataManager::getData(const std::string &name)
stream->open(fullpath, std::ios::binary); stream->open(fullpath, std::ios::binary);
if (stream->fail()) if (stream->fail())
{ {
std::cerr << "DataManager::getData: Failed to open '" << name << "'" << std::endl; Log(Debug::Error) << "DataManager::getData: Failed to open '" << name << "'";
return NULL; return NULL;
} }
return new MyGUI::DataFileStream(stream.release()); return new MyGUI::DataFileStream(stream.release());

@ -5,6 +5,7 @@
#include <osg/Texture2D> #include <osg/Texture2D>
#include <components/debug/debuglog.hpp>
#include <components/resource/imagemanager.hpp> #include <components/resource/imagemanager.hpp>
namespace osgMyGUI namespace osgMyGUI
@ -112,7 +113,7 @@ namespace osgMyGUI
void OSGTexture::saveToFile(const std::string &fname) void OSGTexture::saveToFile(const std::string &fname)
{ {
std::cerr << "Would save image to file " << fname << std::endl; Log(Debug::Warning) << "Would save image to file " << fname;
} }
int OSGTexture::getWidth() int OSGTexture::getWidth()

@ -5,8 +5,8 @@
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
#include <iostream>
#include <components/debug/debuglog.hpp>
#include <components/files/constrainedfilestream.hpp> #include <components/files/constrainedfilestream.hpp>
#include "record.hpp" #include "record.hpp"
@ -80,8 +80,7 @@ public:
/// Used when something goes wrong, but not catastrophically so /// Used when something goes wrong, but not catastrophically so
void warn(const std::string &msg) const override void warn(const std::string &msg) const override
{ {
std::cerr << " NIFFile Warning: " << msg <<std::endl Log(Debug::Warning) << " NIFFile Warning: " << msg << "\nFile: " << filename;
<< "File: " << filename <<std::endl;
} }
/// Open a NIF stream. The name is used for error messages. /// Open a NIF stream. The name is used for error messages.

@ -10,6 +10,8 @@
#include <BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h> #include <BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h>
#include <BulletCollision/CollisionShapes/btCompoundShape.h> #include <BulletCollision/CollisionShapes/btCompoundShape.h>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <components/nif/node.hpp> #include <components/nif/node.hpp>
@ -18,7 +20,6 @@
#include <components/nif/controller.hpp> #include <components/nif/controller.hpp>
#include <components/nif/extra.hpp> #include <components/nif/extra.hpp>
namespace namespace
{ {
@ -203,7 +204,7 @@ void BulletNifLoader::handleNode(const std::string& fileName, const Nif::Node *n
isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode); isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode);
if (node->recType == Nif::RC_RootCollisionNode && autogenerated) if (node->recType == Nif::RC_RootCollisionNode && autogenerated)
std::cerr << "Found RootCollisionNode attached to non-root node in " << fileName << ". Treat it as a common NiTriShape." << std::endl; Log(Debug::Info) << "Found RootCollisionNode attached to non-root node in " << fileName << ". Treat it as a common NiTriShape.";
// Don't collide with AvoidNode shapes // Don't collide with AvoidNode shapes
if(node->recType == Nif::RC_AvoidNode) if(node->recType == Nif::RC_AvoidNode)

@ -4,7 +4,6 @@
#include <cassert> #include <cassert>
#include <string> #include <string>
#include <set> #include <set>
#include <iostream>
#include <map> #include <map>
#include <osg/Matrixf> #include <osg/Matrixf>
@ -12,6 +11,7 @@
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osg/Referenced> #include <osg/Referenced>
#include <components/debug/debuglog.hpp>
#include <components/nif/niffile.hpp> #include <components/nif/niffile.hpp>
#include <components/resource/bulletshape.hpp> #include <components/resource/bulletshape.hpp>
@ -41,12 +41,12 @@ public:
void warn(const std::string &msg) void warn(const std::string &msg)
{ {
std::cerr << "NIFLoader: Warn:" << msg << "\n"; Log(Debug::Warning) << "NIFLoader: Warn:" << msg;
} }
void fail(const std::string &msg) void fail(const std::string &msg)
{ {
std::cerr << "NIFLoader: Fail: "<< msg << std::endl; Log(Debug::Error) << "NIFLoader: Fail: "<< msg;
abort(); abort();
} }

@ -243,7 +243,7 @@ namespace NifOsg
callback->setFunction(std::shared_ptr<NifOsg::ControllerFunction>(new NifOsg::ControllerFunction(key))); callback->setFunction(std::shared_ptr<NifOsg::ControllerFunction>(new NifOsg::ControllerFunction(key)));
if (target.mKeyframeControllers.find(strdata->string) != target.mKeyframeControllers.end()) if (target.mKeyframeControllers.find(strdata->string) != target.mKeyframeControllers.end())
std::cerr << "Warning: controller " << strdata->string << " present more than once in " << nif->getFilename() << ", ignoring later version" << std::endl; Log(Debug::Verbose) << "Controller " << strdata->string << " present more than once in " << nif->getFilename() << ", ignoring later version";
else else
target.mKeyframeControllers[strdata->string] = callback; target.mKeyframeControllers[strdata->string] = callback;
} }
@ -357,20 +357,20 @@ namespace NifOsg
{ {
if (nifNode->recType != Nif::RC_NiTextureEffect) if (nifNode->recType != Nif::RC_NiTextureEffect)
{ {
std::cerr << "Unhandled effect " << nifNode->recName << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled effect " << nifNode->recName << " in " << mFilename;
return; return;
} }
const Nif::NiTextureEffect* textureEffect = static_cast<const Nif::NiTextureEffect*>(nifNode); const Nif::NiTextureEffect* textureEffect = static_cast<const Nif::NiTextureEffect*>(nifNode);
if (textureEffect->textureType != Nif::NiTextureEffect::Environment_Map) if (textureEffect->textureType != Nif::NiTextureEffect::Environment_Map)
{ {
std::cerr << "Unhandled NiTextureEffect type " << textureEffect->textureType << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled NiTextureEffect type " << textureEffect->textureType << " in " << mFilename;
return; return;
} }
if (textureEffect->texture.empty()) if (textureEffect->texture.empty())
{ {
std::cerr << "NiTextureEffect missing source texture in " << mFilename << std::endl; Log(Debug::Info) << "NiTextureEffect missing source texture in " << mFilename;
return; return;
} }
@ -387,7 +387,7 @@ namespace NifOsg
texGen->setMode(osg::TexGen::SPHERE_MAP); texGen->setMode(osg::TexGen::SPHERE_MAP);
break; break;
default: default:
std::cerr << "Unhandled NiTextureEffect coordGenType " << textureEffect->coordGenType << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled NiTextureEffect coordGenType " << textureEffect->coordGenType << " in " << mFilename;
return; return;
} }
@ -638,7 +638,7 @@ namespace NifOsg
else if(ctrl->recType == Nif::RC_NiGeomMorpherController) else if(ctrl->recType == Nif::RC_NiGeomMorpherController)
{} // handled in handleTriShape {} // handled in handleTriShape
else else
std::cerr << "Unhandled controller " << ctrl->recName << " on node " << nifNode->recIndex << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled controller " << ctrl->recName << " on node " << nifNode->recIndex << " in " << mFilename;
} }
} }
@ -664,7 +664,7 @@ namespace NifOsg
handleVisController(static_cast<const Nif::NiVisController*>(ctrl.getPtr()), transformNode, animflags); handleVisController(static_cast<const Nif::NiVisController*>(ctrl.getPtr()), transformNode, animflags);
} }
else else
std::cerr << "Unhandled controller " << ctrl->recName << " on node " << nifNode->recIndex << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled controller " << ctrl->recName << " on node " << nifNode->recIndex << " in " << mFilename;
} }
} }
@ -696,7 +696,7 @@ namespace NifOsg
composite->addController(osgctrl); composite->addController(osgctrl);
} }
else else
std::cerr << "Unexpected material controller " << ctrl->recType << " in " << mFilename << std::endl; Log(Debug::Info) << "Unexpected material controller " << ctrl->recType << " in " << mFilename;
} }
} }
@ -736,7 +736,7 @@ namespace NifOsg
composite->addController(callback); composite->addController(callback);
} }
else else
std::cerr << "Unexpected texture controller " << ctrl->recName << " in " << mFilename << std::endl; Log(Debug::Info) << "Unexpected texture controller " << ctrl->recName << " in " << mFilename;
} }
} }
@ -769,7 +769,7 @@ namespace NifOsg
// unused // unused
} }
else else
std::cerr << "Unhandled particle modifier " << affectors->recName << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled particle modifier " << affectors->recName << " in " << mFilename;
} }
for (; !colliders.empty(); colliders = colliders->extra) for (; !colliders.empty(); colliders = colliders->extra)
{ {
@ -784,7 +784,7 @@ namespace NifOsg
program->addOperator(new SphericalCollider(sphericalcollider)); program->addOperator(new SphericalCollider(sphericalcollider));
} }
else else
std::cerr << "Unhandled particle collider " << colliders->recName << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled particle collider " << colliders->recName << " in " << mFilename;
} }
} }
@ -881,11 +881,11 @@ namespace NifOsg
if(ctrl->recType == Nif::RC_NiParticleSystemController || ctrl->recType == Nif::RC_NiBSPArrayController) if(ctrl->recType == Nif::RC_NiParticleSystemController || ctrl->recType == Nif::RC_NiBSPArrayController)
partctrl = static_cast<Nif::NiParticleSystemController*>(ctrl.getPtr()); partctrl = static_cast<Nif::NiParticleSystemController*>(ctrl.getPtr());
else else
std::cerr << "Unhandled controller " << ctrl->recName << " on node " << nifNode->recIndex << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled controller " << ctrl->recName << " on node " << nifNode->recIndex << " in " << mFilename;
} }
if (!partctrl) if (!partctrl)
{ {
std::cerr << "No particle controller found in " << mFilename << std::endl; Log(Debug::Info) << "No particle controller found in " << mFilename;
return; return;
} }
@ -925,7 +925,7 @@ namespace NifOsg
rootNode->accept(find); rootNode->accept(find);
if (!find.mFound) if (!find.mFound)
{ {
std::cerr << "can't find emitter node, wrong node order? in " << mFilename << std::endl; Log(Debug::Info) << "can't find emitter node, wrong node order? in " << mFilename;
return; return;
} }
osg::Group* emitterNode = find.mFound; osg::Group* emitterNode = find.mFound;
@ -1121,7 +1121,7 @@ namespace NifOsg
case 9: return osg::BlendFunc::ONE_MINUS_DST_ALPHA; case 9: return osg::BlendFunc::ONE_MINUS_DST_ALPHA;
case 10: return osg::BlendFunc::SRC_ALPHA_SATURATE; case 10: return osg::BlendFunc::SRC_ALPHA_SATURATE;
default: default:
std::cerr<< "Unexpected blend mode: "<< mode << " in " << mFilename << std::endl; Log(Debug::Info) << "Unexpected blend mode: "<< mode << " in " << mFilename;
return osg::BlendFunc::SRC_ALPHA; return osg::BlendFunc::SRC_ALPHA;
} }
} }
@ -1139,7 +1139,7 @@ namespace NifOsg
case 6: return osg::AlphaFunc::GEQUAL; case 6: return osg::AlphaFunc::GEQUAL;
case 7: return osg::AlphaFunc::NEVER; case 7: return osg::AlphaFunc::NEVER;
default: default:
std::cerr << "Unexpected blend mode: " << mode << " in " << mFilename << std::endl; Log(Debug::Info) << "Unexpected blend mode: " << mode << " in " << mFilename;
return osg::AlphaFunc::LEQUAL; return osg::AlphaFunc::LEQUAL;
} }
} }
@ -1157,7 +1157,7 @@ namespace NifOsg
case 6: return osg::Stencil::GEQUAL; case 6: return osg::Stencil::GEQUAL;
case 7: return osg::Stencil::NEVER; // NifSkope says this is GL_ALWAYS, but in MW it's GL_NEVER case 7: return osg::Stencil::NEVER; // NifSkope says this is GL_ALWAYS, but in MW it's GL_NEVER
default: default:
std::cerr << "Unexpected stencil function: " << func << " in " << mFilename << std::endl; Log(Debug::Info) << "Unexpected stencil function: " << func << " in " << mFilename;
return osg::Stencil::NEVER; return osg::Stencil::NEVER;
} }
} }
@ -1173,7 +1173,7 @@ namespace NifOsg
case 4: return osg::Stencil::DECR; case 4: return osg::Stencil::DECR;
case 5: return osg::Stencil::INVERT; case 5: return osg::Stencil::INVERT;
default: default:
std::cerr << "Unexpected stencil operation: " << op << " in " << mFilename << std::endl; Log(Debug::Info) << "Unexpected stencil operation: " << op << " in " << mFilename;
return osg::Stencil::KEEP; return osg::Stencil::KEEP;
} }
} }
@ -1192,7 +1192,7 @@ namespace NifOsg
pixelformat = GL_RGBA; pixelformat = GL_RGBA;
break; break;
default: default:
std::cerr << "Unhandled internal pixel format " << pixelData->fmt << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled internal pixel format " << pixelData->fmt << " in " << mFilename;
return NULL; return NULL;
} }
@ -1210,7 +1210,7 @@ namespace NifOsg
size_t mipSize = mip.height * mip.width * pixelData->bpp / 8; size_t mipSize = mip.height * mip.width * pixelData->bpp / 8;
if (mipSize + mip.dataOffset > pixelData->data.size()) if (mipSize + mip.dataOffset > pixelData->data.size())
{ {
std::cerr << "Warning: Internal texture's mipmap data out of bounds, ignoring texture" << std::endl; Log(Debug::Info) << "Internal texture's mipmap data out of bounds, ignoring texture";
return NULL; return NULL;
} }
@ -1225,7 +1225,7 @@ namespace NifOsg
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
{ {
std::cerr << "Warning: Internal Texture Width and height must be non zero, ignoring texture" << std::endl; Log(Debug::Info) << "Internal Texture Width and height must be non zero, ignoring texture";
return NULL; return NULL;
} }
@ -1267,12 +1267,12 @@ namespace NifOsg
{ {
// Not used by the vanilla engine. MCP (Morrowind Code Patch) adds an option to use Gloss maps: // Not used by the vanilla engine. MCP (Morrowind Code Patch) adds an option to use Gloss maps:
// "- Gloss map fix. Morrowind removed gloss map entries from model files after loading them. This stops Morrowind from removing them." // "- Gloss map fix. Morrowind removed gloss map entries from model files after loading them. This stops Morrowind from removing them."
//std::cerr << "NiTexturingProperty::GlossTexture in " << mFilename << " not currently used." << std::endl; // Log(Debug::Info) << "NiTexturingProperty::GlossTexture in " << mFilename << " not currently used.";
continue; continue;
} }
default: default:
{ {
std::cerr << "Warning: unhandled texture stage " << i << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled texture stage " << i << " in " << mFilename;
continue; continue;
} }
} }
@ -1478,7 +1478,7 @@ namespace NifOsg
break; break;
} }
default: default:
std::cerr << "Unhandled " << property->recName << " in " << mFilename << std::endl; Log(Debug::Info) << "Unhandled " << property->recName << " in " << mFilename;
break; break;
} }
} }

@ -5,6 +5,7 @@
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <osg/Geometry> #include <osg/Geometry>
#include <components/debug/debuglog.hpp>
#include <components/nif/controlled.hpp> #include <components/nif/controlled.hpp>
#include <components/nif/nifkey.hpp> #include <components/nif/nifkey.hpp>
#include <components/nif/data.hpp> #include <components/nif/data.hpp>
@ -284,7 +285,7 @@ void Emitter::emitParticles(double dt)
if (!visitor.mFound) if (!visitor.mFound)
{ {
std::cerr << "Error: Can't find emitter node" << randomRecIndex << std::endl; Log(Debug::Info) << "Can't find emitter node" << randomRecIndex;
return; return;
} }

@ -3,6 +3,7 @@
#include <cassert> #include <cassert>
#include <osgDB/Registry> #include <osgDB/Registry>
#include <components/debug/debuglog.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
#include "objectcache.hpp" #include "objectcache.hpp"
@ -97,7 +98,7 @@ namespace Resource
} }
catch (std::exception& e) catch (std::exception& e)
{ {
std::cerr << "Failed to open image: " << e.what() << std::endl; Log(Debug::Error) << "Failed to open image: " << e.what();
mCache->addEntryToObjectCache(normalized, mWarningImage); mCache->addEntryToObjectCache(normalized, mWarningImage);
return mWarningImage; return mWarningImage;
} }
@ -109,7 +110,7 @@ namespace Resource
osgDB::ReaderWriter* reader = osgDB::Registry::instance()->getReaderWriterForExtension(ext); osgDB::ReaderWriter* reader = osgDB::Registry::instance()->getReaderWriterForExtension(ext);
if (!reader) if (!reader)
{ {
std::cerr << "Error loading " << filename << ": no readerwriter for '" << ext << "' found" << std::endl; Log(Debug::Error) << "Error loading " << filename << ": no readerwriter for '" << ext << "' found";
mCache->addEntryToObjectCache(normalized, mWarningImage); mCache->addEntryToObjectCache(normalized, mWarningImage);
return mWarningImage; return mWarningImage;
} }
@ -117,7 +118,7 @@ namespace Resource
osgDB::ReaderWriter::ReadResult result = reader->readImage(*stream, mOptions); osgDB::ReaderWriter::ReadResult result = reader->readImage(*stream, mOptions);
if (!result.success()) if (!result.success())
{ {
std::cerr << "Error loading " << filename << ": " << result.message() << " code " << result.status() << std::endl; Log(Debug::Error) << "Error loading " << filename << ": " << result.message() << " code " << result.status();
mCache->addEntryToObjectCache(normalized, mWarningImage); mCache->addEntryToObjectCache(normalized, mWarningImage);
return mWarningImage; return mWarningImage;
} }
@ -130,7 +131,7 @@ namespace Resource
static bool uncompress = (getenv("OPENMW_DECOMPRESS_TEXTURES") != 0); static bool uncompress = (getenv("OPENMW_DECOMPRESS_TEXTURES") != 0);
if (!uncompress) if (!uncompress)
{ {
std::cerr << "Error loading " << filename << ": no S3TC texture compression support installed" << std::endl; Log(Debug::Error) << "Error loading " << filename << ": no S3TC texture compression support installed";
mCache->addEntryToObjectCache(normalized, mWarningImage); mCache->addEntryToObjectCache(normalized, mWarningImage);
return mWarningImage; return mWarningImage;
} }

@ -1,6 +1,5 @@
#include "scenemanager.hpp" #include "scenemanager.hpp"
#include <iostream>
#include <cstdlib> #include <cstdlib>
#include <osg/Node> #include <osg/Node>
@ -13,6 +12,8 @@
#include <osgDB/SharedStateManager> #include <osgDB/SharedStateManager>
#include <osgDB/Registry> #include <osgDB/Registry>
#include <components/debug/debuglog.hpp>
#include <components/nifosg/nifloader.hpp> #include <components/nifosg/nifloader.hpp>
#include <components/nif/niffile.hpp> #include <components/nif/niffile.hpp>
@ -501,7 +502,7 @@ namespace Resource
normalized = "meshes/marker_error." + std::string(sMeshTypes[i]); normalized = "meshes/marker_error." + std::string(sMeshTypes[i]);
if (mVFS->exists(normalized)) if (mVFS->exists(normalized))
{ {
std::cerr << "Failed to load '" << name << "': " << e.what() << ", using marker_error." << sMeshTypes[i] << " instead" << std::endl; Log(Debug::Error) << "Failed to load '" << name << "': " << e.what() << ", using marker_error." << sMeshTypes[i] << " instead";
Files::IStreamPtr file = mVFS->get(normalized); Files::IStreamPtr file = mVFS->get(normalized);
loaded = load(file, normalized, mImageManager, mNifFileManager); loaded = load(file, normalized, mImageManager, mNifFileManager);
break; break;
@ -658,12 +659,12 @@ namespace Resource
if(magfilter == "nearest") if(magfilter == "nearest")
mag = osg::Texture::NEAREST; mag = osg::Texture::NEAREST;
else if(magfilter != "linear") else if(magfilter != "linear")
std::cerr<< "Warning: Invalid texture mag filter: "<<magfilter <<std::endl; Log(Debug::Warning) << "Warning: Invalid texture mag filter: "<< magfilter;
if(minfilter == "nearest") if(minfilter == "nearest")
min = osg::Texture::NEAREST; min = osg::Texture::NEAREST;
else if(minfilter != "linear") else if(minfilter != "linear")
std::cerr<< "Warning: Invalid texture min filter: "<<minfilter <<std::endl; Log(Debug::Warning) << "Warning: Invalid texture min filter: "<< minfilter;
if(mipmap == "nearest") if(mipmap == "nearest")
{ {
@ -675,7 +676,7 @@ namespace Resource
else if(mipmap != "none") else if(mipmap != "none")
{ {
if(mipmap != "linear") if(mipmap != "linear")
std::cerr<< "Warning: Invalid texture mipmap: "<<mipmap <<std::endl; Log(Debug::Warning) << "Warning: Invalid texture mipmap: " << mipmap;
if(min == osg::Texture::NEAREST) if(min == osg::Texture::NEAREST)
min = osg::Texture::NEAREST_MIPMAP_LINEAR; min = osg::Texture::NEAREST_MIPMAP_LINEAR;
else if(min == osg::Texture::LINEAR) else if(min == osg::Texture::LINEAR)

@ -10,6 +10,7 @@
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <components/sceneutil/skeleton.hpp> #include <components/sceneutil/skeleton.hpp>
@ -63,7 +64,7 @@ namespace SceneUtil
{ {
osg::ref_ptr<osg::Node> node = *it; osg::ref_ptr<osg::Node> node = *it;
if (node->getNumParents() > 1) if (node->getNumParents() > 1)
std::cerr << "Error CopyRigVisitor: node has multiple parents" << std::endl; Log(Debug::Error) << "Error CopyRigVisitor: node has multiple parents";
while (node->getNumParents()) while (node->getNumParents())
node->getParent(0)->removeChild(node); node->getParent(0)->removeChild(node);

@ -1,9 +1,10 @@
#include "riggeometry.hpp" #include "riggeometry.hpp"
#include <stdexcept> #include <stdexcept>
#include <iostream>
#include <cstdlib> #include <cstdlib>
#include <components/debug/debuglog.hpp>
#include "skeleton.hpp" #include "skeleton.hpp"
#include "util.hpp" #include "util.hpp"
@ -96,13 +97,13 @@ bool RigGeometry::initFromParentSkeleton(osg::NodeVisitor* nv)
if (!mSkeleton) if (!mSkeleton)
{ {
std::cerr << "Error: A RigGeometry did not find its parent skeleton" << std::endl; Log(Debug::Error) << "Error: A RigGeometry did not find its parent skeleton";
return false; return false;
} }
if (!mInfluenceMap) if (!mInfluenceMap)
{ {
std::cerr << "Error: No InfluenceMap set on RigGeometry" << std::endl; Log(Debug::Error) << "Error: No InfluenceMap set on RigGeometry";
return false; return false;
} }
@ -113,7 +114,7 @@ bool RigGeometry::initFromParentSkeleton(osg::NodeVisitor* nv)
Bone* bone = mSkeleton->getBone(it->first); Bone* bone = mSkeleton->getBone(it->first);
if (!bone) if (!bone)
{ {
std::cerr << "Error: RigGeometry did not find bone " << it->first << std::endl; Log(Debug::Error) << "Error: RigGeometry did not find bone " << it->first ;
continue; continue;
} }
@ -166,7 +167,7 @@ void RigGeometry::cull(osg::NodeVisitor* nv)
{ {
if (!mSkeleton) if (!mSkeleton)
{ {
std::cerr << "Error: RigGeometry rendering with no skeleton, should have been initialized by UpdateVisitor" << std::endl; Log(Debug::Error) << "Error: RigGeometry rendering with no skeleton, should have been initialized by UpdateVisitor";
// try to recover anyway, though rendering is likely to be incorrect. // try to recover anyway, though rendering is likely to be incorrect.
if (!initFromParentSkeleton(nv)) if (!initFromParentSkeleton(nv))
return; return;

@ -3,10 +3,9 @@
#include <osg/Transform> #include <osg/Transform>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <iostream>
namespace SceneUtil namespace SceneUtil
{ {
@ -183,7 +182,7 @@ void Bone::update(const osg::Matrixf* parentMatrixInSkeletonSpace)
{ {
if (!mNode) if (!mNode)
{ {
std::cerr << "Error: Bone without node " << std::endl; Log(Debug::Error) << "Error: Bone without node";
return; return;
} }
if (parentMatrixInSkeletonSpace) if (parentMatrixInSkeletonSpace)

@ -3,8 +3,8 @@
#include <deque> #include <deque>
//#include <osg/Timer> //#include <osg/Timer>
//#include <iostream>
//#include <components/debug/debuglog.hpp>
#include <components/sceneutil/workqueue.hpp> #include <components/sceneutil/workqueue.hpp>
namespace SceneUtil namespace SceneUtil
@ -20,7 +20,7 @@ namespace SceneUtil
//osg::Timer timer; //osg::Timer timer;
//size_t objcount = mObjects.size(); //size_t objcount = mObjects.size();
mObjects.clear(); mObjects.clear();
//std::cout << "cleared " << objcount << " objects in " << timer.time_m() << std::endl; //Log(Debug::Verbose) << "cleared " << objcount << " objects in " << timer.time_m();
} }
}; };

@ -1,6 +1,6 @@
#include "workqueue.hpp" #include "workqueue.hpp"
#include <iostream> #include <components/debug/debuglog.hpp>
namespace SceneUtil namespace SceneUtil
{ {
@ -71,7 +71,7 @@ void WorkQueue::addWorkItem(osg::ref_ptr<WorkItem> item, bool front)
{ {
if (item->isDone()) if (item->isDone())
{ {
std::cerr << "Error: trying to add a work item that is already completed" << std::endl; Log(Debug::Error) << "Error: trying to add a work item that is already completed";
return; return;
} }

@ -17,6 +17,8 @@
#include <osg/Version> #include <osg/Version>
#include <osgViewer/GraphicsWindow> #include <osgViewer/GraphicsWindow>
#include <components/debug/debuglog.hpp>
#include "imagetosurface.hpp" #include "imagetosurface.hpp"
#if defined(OSG_LIBRARY_STATIC) && !defined(ANDROID) #if defined(OSG_LIBRARY_STATIC) && !defined(ANDROID)
@ -63,7 +65,7 @@ namespace CursorDecompression
if (!_gc) if (!_gc)
{ {
std::cerr << "Failed to create pbuffer, failing back to normal graphics window." << std::endl; Log(Debug::Warning) << "Failed to create pbuffer, failing back to normal graphics window.";
traits->pbuffer = false; traits->pbuffer = false;
_gc = osg::GraphicsContext::createGraphicsContext(traits.get()); _gc = osg::GraphicsContext::createGraphicsContext(traits.get());
@ -283,8 +285,8 @@ namespace SDLUtil
mCursorMap.insert(CursorMap::value_type(std::string(name), curs)); mCursorMap.insert(CursorMap::value_type(std::string(name), curs));
} catch (std::exception& e) { } catch (std::exception& e) {
std::cerr << e.what() << std::endl; Log(Debug::Warning) << e.what();
std::cerr <<"Using default cursor."<<std::endl; Log(Debug::Warning) << "Using default cursor.";
return; return;
} }
} }

@ -1,6 +1,6 @@
#include "sdlinputwrapper.hpp" #include "sdlinputwrapper.hpp"
#include <iostream> #include <components/debug/debuglog.hpp>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
@ -160,9 +160,7 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
break; break;
default: default:
std::ios::fmtflags f(std::cerr.flags()); Log(Debug::Info) << "Unhandled SDL event of type 0x" << std::hex << evt.type;
std::cerr << "Unhandled SDL event of type 0x" << std::hex << evt.type << std::endl;
std::cerr.flags(f);
break; break;
} }
} }

@ -1,6 +1,6 @@
#include "sdlvideowrapper.hpp" #include "sdlvideowrapper.hpp"
#include <iostream> #include <components/debug/debuglog.hpp>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
@ -65,7 +65,7 @@ namespace SDLUtil
red[i] = green[i] = blue[i] = static_cast<Uint16>(value); red[i] = green[i] = blue[i] = static_cast<Uint16>(value);
} }
if (SDL_SetWindowGammaRamp(mWindow, red, green, blue) < 0) if (SDL_SetWindowGammaRamp(mWindow, red, green, blue) < 0)
std::cout << "Couldn't set gamma: " << SDL_GetError() << std::endl; Log(Debug::Warning) << "Couldn't set gamma: " << SDL_GetError();
} }
void VideoWrapper::setVideoMode(int width, int height, bool fullscreen, bool windowBorder) void VideoWrapper::setVideoMode(int width, int height, bool fullscreen, bool windowBorder)

@ -1,8 +1,8 @@
#include "settings.hpp" #include "settings.hpp"
#include <sstream> #include <sstream>
#include <iostream>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
@ -69,7 +69,7 @@ public:
mFile = file; mFile = file;
boost::filesystem::ifstream stream; boost::filesystem::ifstream stream;
stream.open(boost::filesystem::path(file)); stream.open(boost::filesystem::path(file));
std::cout << "Loading settings file: " << file << std::endl; Log(Debug::Info) << "Loading settings file: " << file;
std::string currentCategory; std::string currentCategory;
mLine = 0; mLine = 0;
while (!stream.eof() && !stream.fail()) while (!stream.eof() && !stream.fail())
@ -186,8 +186,8 @@ public:
// Ensure that all options in the current category have been written. // Ensure that all options in the current category have been written.
for (CategorySettingStatusMap::iterator mit = written.begin(); mit != written.end(); ++mit) { for (CategorySettingStatusMap::iterator mit = written.begin(); mit != written.end(); ++mit) {
if (mit->second == false && mit->first.first == currentCategory) { if (mit->second == false && mit->first.first == currentCategory) {
std::cout << "Added new setting: [" << currentCategory << "] " Log(Debug::Verbose) << "Added new setting: [" << currentCategory << "] "
<< mit->first.second << " = " << settings[mit->first] << std::endl; << mit->first.second << " = " << settings[mit->first];
ostream << mit->first.second << " = " << settings[mit->first] << std::endl; ostream << mit->first.second << " = " << settings[mit->first] << std::endl;
mit->second = true; mit->second = true;
changed = true; changed = true;
@ -200,7 +200,7 @@ public:
// Write the (new) current category to the file. // Write the (new) current category to the file.
ostream << "[" << currentCategory << "]" << std::endl; ostream << "[" << currentCategory << "]" << std::endl;
//std::cout << "Wrote category: " << currentCategory << std::endl; // Log(Debug::Verbose) << "Wrote category: " << currentCategory;
// A setting can apparently follow the category on an input line. That's rather // A setting can apparently follow the category on an input line. That's rather
// inconvenient, since it makes it more likely to have duplicative sections, // inconvenient, since it makes it more likely to have duplicative sections,
@ -259,8 +259,8 @@ public:
finder->second = true; finder->second = true;
// Did we really change it? // Did we really change it?
if (value != settings[key]) { if (value != settings[key]) {
std::cout << "Changed setting: [" << currentCategory << "] " Log(Debug::Verbose) << "Changed setting: [" << currentCategory << "] "
<< setting << " = " << settings[key] << std::endl; << setting << " = " << settings[key];
changed = true; changed = true;
} }
// No need to write the current line, because we just emitted a replacement. // No need to write the current line, because we just emitted a replacement.
@ -276,8 +276,8 @@ public:
// the current category at the end of the file before moving on to any new categories. // the current category at the end of the file before moving on to any new categories.
for (CategorySettingStatusMap::iterator mit = written.begin(); mit != written.end(); ++mit) { for (CategorySettingStatusMap::iterator mit = written.begin(); mit != written.end(); ++mit) {
if (mit->second == false && mit->first.first == currentCategory) { if (mit->second == false && mit->first.first == currentCategory) {
std::cout << "Added new setting: [" << mit->first.first << "] " Log(Debug::Verbose) << "Added new setting: [" << mit->first.first << "] "
<< mit->first.second << " = " << settings[mit->first] << std::endl; << mit->first.second << " = " << settings[mit->first];
ostream << mit->first.second << " = " << settings[mit->first] << std::endl; ostream << mit->first.second << " = " << settings[mit->first] << std::endl;
mit->second = true; mit->second = true;
changed = true; changed = true;
@ -305,12 +305,12 @@ public:
// If the catgory has changed, write a new category header. // If the catgory has changed, write a new category header.
if (mit->first.first != currentCategory) { if (mit->first.first != currentCategory) {
currentCategory = mit->first.first; currentCategory = mit->first.first;
std::cout << "Created new setting section: " << mit->first.first << std::endl; Log(Debug::Verbose) << "Created new setting section: " << mit->first.first;
ostream << std::endl; ostream << std::endl;
ostream << "[" << currentCategory << "]" << std::endl; ostream << "[" << currentCategory << "]" << std::endl;
} }
std::cout << "Added new setting: [" << mit->first.first << "] " Log(Debug::Verbose) << "Added new setting: [" << mit->first.first << "] "
<< mit->first.second << " = " << settings[mit->first] << std::endl; << mit->first.second << " = " << settings[mit->first];
// Then write the setting. No need to mark it as written because we're done. // Then write the setting. No need to mark it as written because we're done.
ostream << mit->first.second << " = " << settings[mit->first] << std::endl; ostream << mit->first.second << " = " << settings[mit->first] << std::endl;
changed = true; changed = true;
@ -319,7 +319,7 @@ public:
// Now install the newly written file in the requested place. // Now install the newly written file in the requested place.
if (changed) { if (changed) {
std::cout << "Updating settings file: " << ipath << std::endl; Log(Debug::Info) << "Updating settings file: " << ipath;
boost::filesystem::ofstream ofstream; boost::filesystem::ofstream ofstream;
ofstream.open(ipath); ofstream.open(ipath);
ofstream << ostream.rdbuf(); ofstream << ostream.rdbuf();

@ -11,6 +11,8 @@
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <components/debug/debuglog.hpp>
namespace Shader namespace Shader
{ {
@ -31,13 +33,13 @@ namespace Shader
size_t start = source.find('"', foundPos); size_t start = source.find('"', foundPos);
if (start == std::string::npos || start == source.size()-1) if (start == std::string::npos || start == source.size()-1)
{ {
std::cerr << "Invalid #include " << std::endl; Log(Debug::Error) << "Invalid #include";
return false; return false;
} }
size_t end = source.find('"', start+1); size_t end = source.find('"', start+1);
if (end == std::string::npos) if (end == std::string::npos)
{ {
std::cerr << "Invalid #include " << std::endl; Log(Debug::Error) << "Invalid #include";
return false; return false;
} }
std::string includeFilename = source.substr(start+1, end-(start+1)); std::string includeFilename = source.substr(start+1, end-(start+1));
@ -46,7 +48,7 @@ namespace Shader
includeFstream.open(includePath); includeFstream.open(includePath);
if (includeFstream.fail()) if (includeFstream.fail())
{ {
std::cerr << "Failed to open " << includePath.string() << std::endl; Log(Debug::Error) << "Failed to open " << includePath.string();
return false; return false;
} }
@ -65,7 +67,7 @@ namespace Shader
if (includedFiles.insert(includePath).second == false) if (includedFiles.insert(includePath).second == false)
{ {
std::cerr << "Detected cyclic #includes" << std::endl; Log(Debug::Error) << "Detected cyclic #includes";
return false; return false;
} }
} }
@ -81,14 +83,14 @@ namespace Shader
size_t endPos = source.find_first_of(" \n\r()[].;", foundPos); size_t endPos = source.find_first_of(" \n\r()[].;", foundPos);
if (endPos == std::string::npos) if (endPos == std::string::npos)
{ {
std::cerr << "Unexpected EOF" << std::endl; Log(Debug::Error) << "Unexpected EOF";
return false; return false;
} }
std::string define = source.substr(foundPos+1, endPos - (foundPos+1)); std::string define = source.substr(foundPos+1, endPos - (foundPos+1));
ShaderManager::DefineMap::const_iterator defineFound = defines.find(define); ShaderManager::DefineMap::const_iterator defineFound = defines.find(define);
if (defineFound == defines.end()) if (defineFound == defines.end())
{ {
std::cerr << "Undefined " << define << std::endl; Log(Debug::Error) << "Undefined " << define;
return false; return false;
} }
else else
@ -112,7 +114,7 @@ namespace Shader
stream.open(p); stream.open(p);
if (stream.fail()) if (stream.fail())
{ {
std::cerr << "Failed to open " << p.string() << std::endl; Log(Debug::Error) << "Failed to open " << p.string();
return NULL; return NULL;
} }
std::stringstream buffer; std::stringstream buffer;

@ -10,6 +10,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <components/debug/debuglog.hpp>
#include <components/resource/imagemanager.hpp> #include <components/resource/imagemanager.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
#include <components/sceneutil/riggeometry.hpp> #include <components/sceneutil/riggeometry.hpp>
@ -147,7 +148,7 @@ namespace Shader
specularMap = texture; specularMap = texture;
} }
else else
std::cerr << "ShaderVisitor encountered unknown texture " << texture << std::endl; Log(Debug::Error) << "ShaderVisitor encountered unknown texture " << texture;
} }
} }
} }

@ -2,10 +2,11 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <iostream>
#include <iomanip> #include <iomanip>
#include <stdexcept> #include <stdexcept>
#include <components/debug/debuglog.hpp>
/* This file contains the code to translate from WINDOWS-1252 (native /* This file contains the code to translate from WINDOWS-1252 (native
charset used in English version of Morrowind) to UTF-8. The library charset used in English version of Morrowind) to UTF-8. The library
is designed to be extened to support more source encodings later, is designed to be extened to support more source encodings later,
@ -319,9 +320,7 @@ void Utf8Encoder::copyFromArray2(const char*& chp, char* &out)
} }
} }
std::ios::fmtflags f(std::cout.flags()); Log(Debug::Info) << "Could not find glyph " << std::hex << (int)ch << " " << (int)ch2 << " " << (int)ch3;
std::cout << "Could not find glyph " << std::hex << (int)ch << " " << (int)ch2 << " " << (int)ch3 << std::endl;
std::cout.flags(f);
*(out++) = ch; // Could not find glyph, just put whatever *(out++) = ch; // Could not find glyph, just put whatever
} }

@ -1,9 +1,9 @@
#include "filesystemarchive.hpp" #include "filesystemarchive.hpp"
#include <iostream>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <components/debug/debuglog.hpp>
namespace VFS namespace VFS
{ {
@ -41,7 +41,7 @@ namespace VFS
std::transform(proper.begin() + prefix, proper.end(), std::back_inserter(searchable), normalize_function); std::transform(proper.begin() + prefix, proper.end(), std::back_inserter(searchable), normalize_function);
if (!mIndex.insert (std::make_pair (searchable, file)).second) if (!mIndex.insert (std::make_pair (searchable, file)).second)
std::cerr << "Warning: found duplicate file for '" << proper << "', please check your file system for two files with the same name in different cases." << std::endl; Log(Debug::Warning) << "Warning: found duplicate file for '" << proper << "', please check your file system for two files with the same name in different cases.";
} }
mBuiltIndex = true; mBuiltIndex = true;

@ -1,9 +1,10 @@
#include "registerarchives.hpp" #include "registerarchives.hpp"
#include <set> #include <set>
#include <iostream>
#include <sstream> #include <sstream>
#include <components/debug/debuglog.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
#include <components/vfs/bsaarchive.hpp> #include <components/vfs/bsaarchive.hpp>
#include <components/vfs/filesystemarchive.hpp> #include <components/vfs/filesystemarchive.hpp>
@ -21,7 +22,7 @@ namespace VFS
{ {
// Last BSA has the highest priority // Last BSA has the highest priority
const std::string archivePath = collections.getPath(*archive).string(); const std::string archivePath = collections.getPath(*archive).string();
std::cout << "Adding BSA archive " << archivePath << std::endl; Log(Debug::Info) << "Adding BSA archive " << archivePath;
vfs->addArchive(new BsaArchive(archivePath)); vfs->addArchive(new BsaArchive(archivePath));
} }
@ -40,12 +41,12 @@ namespace VFS
{ {
if (seen.insert(*iter).second) if (seen.insert(*iter).second)
{ {
std::cout << "Adding data directory " << iter->string() << std::endl; Log(Debug::Info) << "Adding data directory " << iter->string();
// Last data dir has the highest priority // Last data dir has the highest priority
vfs->addArchive(new FileSystemArchive(iter->string())); vfs->addArchive(new FileSystemArchive(iter->string()));
} }
else else
std::cerr << "Ignoring duplicate data directory " << iter->string() << std::endl; Log(Debug::Info) << "Ignoring duplicate data directory " << iter->string();
} }
} }

@ -2,6 +2,8 @@
#include <MyGUI_RenderManager.h> #include <MyGUI_RenderManager.h>
#include <components/debug/debuglog.hpp>
namespace Gui namespace Gui
{ {
@ -77,7 +79,7 @@ namespace Gui
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(mImageNormal); MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(mImageNormal);
if (!texture) if (!texture)
{ {
std::cerr << "ImageButton: can't find " << mImageNormal << std::endl; Log(Debug::Error) << "ImageButton: can't find image " << mImageNormal;
return MyGUI::IntSize(0,0); return MyGUI::IntSize(0,0);
} }
return MyGUI::IntSize (texture->getWidth(), texture->getHeight()); return MyGUI::IntSize (texture->getWidth(), texture->getHeight());

Loading…
Cancel
Save