Use new logging system for components

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

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

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

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

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

@ -1,6 +1,6 @@
#include "loaddial.hpp"
#include <iostream>
#include <components/debug/debuglog.hpp>
#include "esmreader.hpp"
#include "esmwriter.hpp"
@ -128,7 +128,7 @@ namespace ESM
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()

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

@ -10,6 +10,7 @@
#include <boost/algorithm/string.hpp>
#include <components/debug/debuglog.hpp>
#include <components/misc/resourcehelpers.hpp>
#include <components/vfs/manager.hpp>
@ -378,7 +379,7 @@ namespace ESMTerrain
const ESM::LandTexture* ltex = getLandTexture(id.first-1, id.second);
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;
}

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

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

@ -14,6 +14,8 @@
#include <MyGUI_FactoryManager.h>
#include <MyGUI_RenderManager.h>
#include <components/debug/debuglog.hpp>
#include <components/vfs/manager.hpp>
#include <components/misc/stringops.hpp>
@ -281,7 +283,7 @@ namespace Gui
assert (image->isDataContiguous());
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");
}
@ -461,7 +463,7 @@ namespace Gui
if (exportToFile)
{
std::cout << "Writing " << resourceName + ".xml" << std::endl;
Log(Debug::Info) << "Writing " << resourceName + ".xml";
xmlDocument.createDeclaration();
xmlDocument.save(resourceName + ".xml");
}

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

@ -5,7 +5,7 @@
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <iostream>
#include <components/debug/debuglog.hpp>
namespace osgMyGUI
{
@ -23,7 +23,7 @@ MyGUI::IDataStream *DataManager::getData(const std::string &name)
stream->open(fullpath, std::ios::binary);
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 new MyGUI::DataFileStream(stream.release());

@ -5,6 +5,7 @@
#include <osg/Texture2D>
#include <components/debug/debuglog.hpp>
#include <components/resource/imagemanager.hpp>
namespace osgMyGUI
@ -112,7 +113,7 @@ namespace osgMyGUI
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()

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

@ -10,6 +10,8 @@
#include <BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h>
#include <BulletCollision/CollisionShapes/btCompoundShape.h>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp>
#include <components/nif/node.hpp>
@ -18,7 +20,6 @@
#include <components/nif/controller.hpp>
#include <components/nif/extra.hpp>
namespace
{
@ -203,7 +204,7 @@ void BulletNifLoader::handleNode(const std::string& fileName, const Nif::Node *n
isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode);
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
if(node->recType == Nif::RC_AvoidNode)

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

@ -243,7 +243,7 @@ namespace NifOsg
callback->setFunction(std::shared_ptr<NifOsg::ControllerFunction>(new NifOsg::ControllerFunction(key)));
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
target.mKeyframeControllers[strdata->string] = callback;
}
@ -357,20 +357,20 @@ namespace NifOsg
{
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;
}
const Nif::NiTextureEffect* textureEffect = static_cast<const Nif::NiTextureEffect*>(nifNode);
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;
}
if (textureEffect->texture.empty())
{
std::cerr << "NiTextureEffect missing source texture in " << mFilename << std::endl;
Log(Debug::Info) << "NiTextureEffect missing source texture in " << mFilename;
return;
}
@ -387,7 +387,7 @@ namespace NifOsg
texGen->setMode(osg::TexGen::SPHERE_MAP);
break;
default:
std::cerr << "Unhandled NiTextureEffect coordGenType " << textureEffect->coordGenType << " in " << mFilename << std::endl;
Log(Debug::Info) << "Unhandled NiTextureEffect coordGenType " << textureEffect->coordGenType << " in " << mFilename;
return;
}
@ -638,7 +638,7 @@ namespace NifOsg
else if(ctrl->recType == Nif::RC_NiGeomMorpherController)
{} // handled in handleTriShape
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);
}
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);
}
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);
}
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
}
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)
{
@ -784,7 +784,7 @@ namespace NifOsg
program->addOperator(new SphericalCollider(sphericalcollider));
}
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)
partctrl = static_cast<Nif::NiParticleSystemController*>(ctrl.getPtr());
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)
{
std::cerr << "No particle controller found in " << mFilename << std::endl;
Log(Debug::Info) << "No particle controller found in " << mFilename;
return;
}
@ -925,7 +925,7 @@ namespace NifOsg
rootNode->accept(find);
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;
}
osg::Group* emitterNode = find.mFound;
@ -1121,7 +1121,7 @@ namespace NifOsg
case 9: return osg::BlendFunc::ONE_MINUS_DST_ALPHA;
case 10: return osg::BlendFunc::SRC_ALPHA_SATURATE;
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;
}
}
@ -1139,7 +1139,7 @@ namespace NifOsg
case 6: return osg::AlphaFunc::GEQUAL;
case 7: return osg::AlphaFunc::NEVER;
default:
std::cerr << "Unexpected blend mode: " << mode << " in " << mFilename << std::endl;
Log(Debug::Info) << "Unexpected blend mode: " << mode << " in " << mFilename;
return osg::AlphaFunc::LEQUAL;
}
}
@ -1157,7 +1157,7 @@ namespace NifOsg
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
default:
std::cerr << "Unexpected stencil function: " << func << " in " << mFilename << std::endl;
Log(Debug::Info) << "Unexpected stencil function: " << func << " in " << mFilename;
return osg::Stencil::NEVER;
}
}
@ -1173,7 +1173,7 @@ namespace NifOsg
case 4: return osg::Stencil::DECR;
case 5: return osg::Stencil::INVERT;
default:
std::cerr << "Unexpected stencil operation: " << op << " in " << mFilename << std::endl;
Log(Debug::Info) << "Unexpected stencil operation: " << op << " in " << mFilename;
return osg::Stencil::KEEP;
}
}
@ -1192,7 +1192,7 @@ namespace NifOsg
pixelformat = GL_RGBA;
break;
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;
}
@ -1210,7 +1210,7 @@ namespace NifOsg
size_t mipSize = mip.height * mip.width * pixelData->bpp / 8;
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;
}
@ -1225,7 +1225,7 @@ namespace NifOsg
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;
}
@ -1267,12 +1267,12 @@ namespace NifOsg
{
// 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."
//std::cerr << "NiTexturingProperty::GlossTexture in " << mFilename << " not currently used." << std::endl;
// Log(Debug::Info) << "NiTexturingProperty::GlossTexture in " << mFilename << " not currently used.";
continue;
}
default:
{
std::cerr << "Warning: unhandled texture stage " << i << " in " << mFilename << std::endl;
Log(Debug::Info) << "Unhandled texture stage " << i << " in " << mFilename;
continue;
}
}
@ -1478,7 +1478,7 @@ namespace NifOsg
break;
}
default:
std::cerr << "Unhandled " << property->recName << " in " << mFilename << std::endl;
Log(Debug::Info) << "Unhandled " << property->recName << " in " << mFilename;
break;
}
}

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

@ -3,6 +3,7 @@
#include <cassert>
#include <osgDB/Registry>
#include <components/debug/debuglog.hpp>
#include <components/vfs/manager.hpp>
#include "objectcache.hpp"
@ -97,7 +98,7 @@ namespace Resource
}
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);
return mWarningImage;
}
@ -109,7 +110,7 @@ namespace Resource
osgDB::ReaderWriter* reader = osgDB::Registry::instance()->getReaderWriterForExtension(ext);
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);
return mWarningImage;
}
@ -117,7 +118,7 @@ namespace Resource
osgDB::ReaderWriter::ReadResult result = reader->readImage(*stream, mOptions);
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);
return mWarningImage;
}
@ -130,7 +131,7 @@ namespace Resource
static bool uncompress = (getenv("OPENMW_DECOMPRESS_TEXTURES") != 0);
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);
return mWarningImage;
}

@ -1,6 +1,5 @@
#include "scenemanager.hpp"
#include <iostream>
#include <cstdlib>
#include <osg/Node>
@ -13,6 +12,8 @@
#include <osgDB/SharedStateManager>
#include <osgDB/Registry>
#include <components/debug/debuglog.hpp>
#include <components/nifosg/nifloader.hpp>
#include <components/nif/niffile.hpp>
@ -501,7 +502,7 @@ namespace Resource
normalized = "meshes/marker_error." + std::string(sMeshTypes[i]);
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);
loaded = load(file, normalized, mImageManager, mNifFileManager);
break;
@ -658,12 +659,12 @@ namespace Resource
if(magfilter == "nearest")
mag = osg::Texture::NEAREST;
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")
min = osg::Texture::NEAREST;
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")
{
@ -675,7 +676,7 @@ namespace Resource
else if(mipmap != "none")
{
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)
min = osg::Texture::NEAREST_MIPMAP_LINEAR;
else if(min == osg::Texture::LINEAR)

@ -10,6 +10,7 @@
#include <osg/PositionAttitudeTransform>
#include <osg/MatrixTransform>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp>
#include <components/sceneutil/skeleton.hpp>
@ -63,7 +64,7 @@ namespace SceneUtil
{
osg::ref_ptr<osg::Node> node = *it;
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())
node->getParent(0)->removeChild(node);

@ -1,9 +1,10 @@
#include "riggeometry.hpp"
#include <stdexcept>
#include <iostream>
#include <cstdlib>
#include <components/debug/debuglog.hpp>
#include "skeleton.hpp"
#include "util.hpp"
@ -96,13 +97,13 @@ bool RigGeometry::initFromParentSkeleton(osg::NodeVisitor* nv)
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;
}
if (!mInfluenceMap)
{
std::cerr << "Error: No InfluenceMap set on RigGeometry" << std::endl;
Log(Debug::Error) << "Error: No InfluenceMap set on RigGeometry";
return false;
}
@ -113,7 +114,7 @@ bool RigGeometry::initFromParentSkeleton(osg::NodeVisitor* nv)
Bone* bone = mSkeleton->getBone(it->first);
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;
}
@ -166,7 +167,7 @@ void RigGeometry::cull(osg::NodeVisitor* nv)
{
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.
if (!initFromParentSkeleton(nv))
return;

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

@ -3,8 +3,8 @@
#include <deque>
//#include <osg/Timer>
//#include <iostream>
//#include <components/debug/debuglog.hpp>
#include <components/sceneutil/workqueue.hpp>
namespace SceneUtil
@ -20,7 +20,7 @@ namespace SceneUtil
//osg::Timer timer;
//size_t objcount = mObjects.size();
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 <iostream>
#include <components/debug/debuglog.hpp>
namespace SceneUtil
{
@ -71,7 +71,7 @@ void WorkQueue::addWorkItem(osg::ref_ptr<WorkItem> item, bool front)
{
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;
}

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

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

@ -1,6 +1,6 @@
#include "sdlvideowrapper.hpp"
#include <iostream>
#include <components/debug/debuglog.hpp>
#include <osgViewer/Viewer>
@ -65,7 +65,7 @@ namespace SDLUtil
red[i] = green[i] = blue[i] = static_cast<Uint16>(value);
}
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)

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

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

@ -10,6 +10,7 @@
#include <boost/algorithm/string.hpp>
#include <components/debug/debuglog.hpp>
#include <components/resource/imagemanager.hpp>
#include <components/vfs/manager.hpp>
#include <components/sceneutil/riggeometry.hpp>
@ -147,7 +148,7 @@ namespace Shader
specularMap = texture;
}
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 <cassert>
#include <iostream>
#include <iomanip>
#include <stdexcept>
#include <components/debug/debuglog.hpp>
/* This file contains the code to translate from WINDOWS-1252 (native
charset used in English version of Morrowind) to UTF-8. The library
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());
std::cout << "Could not find glyph " << std::hex << (int)ch << " " << (int)ch2 << " " << (int)ch3 << std::endl;
std::cout.flags(f);
Log(Debug::Info) << "Could not find glyph " << std::hex << (int)ch << " " << (int)ch2 << " " << (int)ch3;
*(out++) = ch; // Could not find glyph, just put whatever
}

@ -1,9 +1,9 @@
#include "filesystemarchive.hpp"
#include <iostream>
#include <boost/filesystem.hpp>
#include <components/debug/debuglog.hpp>
namespace VFS
{
@ -41,7 +41,7 @@ namespace VFS
std::transform(proper.begin() + prefix, proper.end(), std::back_inserter(searchable), normalize_function);
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;

@ -1,9 +1,10 @@
#include "registerarchives.hpp"
#include <set>
#include <iostream>
#include <sstream>
#include <components/debug/debuglog.hpp>
#include <components/vfs/manager.hpp>
#include <components/vfs/bsaarchive.hpp>
#include <components/vfs/filesystemarchive.hpp>
@ -21,7 +22,7 @@ namespace VFS
{
// Last BSA has the highest priority
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));
}
@ -40,12 +41,12 @@ namespace VFS
{
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
vfs->addArchive(new FileSystemArchive(iter->string()));
}
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 <components/debug/debuglog.hpp>
namespace Gui
{
@ -77,7 +79,7 @@ namespace Gui
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(mImageNormal);
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 (texture->getWidth(), texture->getHeight());

Loading…
Cancel
Save