mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 19:53:53 +00:00
Use new logging system for editor
This commit is contained in:
parent
1452684d9e
commit
c7a5548475
6 changed files with 19 additions and 20 deletions
|
@ -5,8 +5,8 @@
|
||||||
#include <QLocalSocket>
|
#include <QLocalSocket>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/fallback/validate.hpp>
|
#include <components/fallback/validate.hpp>
|
||||||
|
|
||||||
#include <components/nifosg/nifloader.hpp>
|
#include <components/nifosg/nifloader.hpp>
|
||||||
|
|
||||||
#include "model/doc/document.hpp"
|
#include "model/doc/document.hpp"
|
||||||
|
@ -294,7 +294,7 @@ bool CS::Editor::makeIPCServer()
|
||||||
mLock = boost::interprocess::file_lock(mPid.string().c_str());
|
mLock = boost::interprocess::file_lock(mPid.string().c_str());
|
||||||
if(!mLock.try_lock())
|
if(!mLock.try_lock())
|
||||||
{
|
{
|
||||||
std::cerr << "OpenCS already running." << std::endl;
|
Log(Debug::Error) << "Error: OpenMW-CS is already running.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,17 +317,17 @@ bool CS::Editor::makeIPCServer()
|
||||||
if(boost::filesystem::exists(fullPath.toUtf8().constData()))
|
if(boost::filesystem::exists(fullPath.toUtf8().constData()))
|
||||||
{
|
{
|
||||||
// TODO: compare pid of the current process with that in the file
|
// TODO: compare pid of the current process with that in the file
|
||||||
std::cout << "Detected unclean shutdown." << std::endl;
|
Log(Debug::Info) << "Detected unclean shutdown.";
|
||||||
// delete the stale file
|
// delete the stale file
|
||||||
if(remove(fullPath.toUtf8().constData()))
|
if(remove(fullPath.toUtf8().constData()))
|
||||||
std::cerr << "ERROR removing stale connection file" << std::endl;
|
Log(Debug::Error) << "Error: can not remove stale connection file.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(const std::exception& e)
|
catch(const std::exception& e)
|
||||||
{
|
{
|
||||||
std::cerr << "ERROR " << e.what() << std::endl;
|
Log(Debug::Error) << "Error: " << e.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "editor.hpp"
|
#include "editor.hpp"
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -31,7 +30,7 @@ class Application : public QApplication
|
||||||
}
|
}
|
||||||
catch (const std::exception& exception)
|
catch (const std::exception& exception)
|
||||||
{
|
{
|
||||||
std::cerr << "An exception has been caught: " << exception.what() << std::endl;
|
Log(Debug::Error) << "An exception has been caught: " << exception.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
@ -13,6 +12,8 @@
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <components/debug/debuglog.hpp>
|
||||||
|
|
||||||
void CSMDoc::Document::addGmsts()
|
void CSMDoc::Document::addGmsts()
|
||||||
{
|
{
|
||||||
for (size_t i=0; i < CSMWorld::DefaultGmsts::FloatCount; ++i)
|
for (size_t i=0; i < CSMWorld::DefaultGmsts::FloatCount; ++i)
|
||||||
|
@ -435,7 +436,7 @@ void CSMDoc::Document::modificationStateChanged (bool clean)
|
||||||
void CSMDoc::Document::reportMessage (const CSMDoc::Message& message, int type)
|
void CSMDoc::Document::reportMessage (const CSMDoc::Message& message, int type)
|
||||||
{
|
{
|
||||||
/// \todo find a better way to get these messages to the user.
|
/// \todo find a better way to get these messages to the user.
|
||||||
std::cout << message.mMessage << std::endl;
|
Log(Debug::Info) << message.mMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Document::operationDone2 (int type, bool failed)
|
void CSMDoc::Document::operationDone2 (int type, bool failed)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "refcollection.hpp"
|
#include "refcollection.hpp"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
#include <components/esm/loadcell.hpp>
|
#include <components/esm/loadcell.hpp>
|
||||||
|
|
||||||
|
@ -58,10 +58,10 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
||||||
// message
|
// message
|
||||||
if (index.first != mref.mTarget[0] || index.second != mref.mTarget[1])
|
if (index.first != mref.mTarget[0] || index.second != mref.mTarget[1])
|
||||||
{
|
{
|
||||||
std::cerr << "The Position of moved ref "
|
Log(Debug::Warning) << "Warning: the Position of moved ref "
|
||||||
<< ref.mRefID << " does not match the target cell" << std::endl;
|
<< ref.mRefID << " does not match the target cell";
|
||||||
std::cerr << "Position: #" << index.first << " " << index.second
|
Log(Debug::Warning) << "Position: #" << index.first << " " << index.second
|
||||||
<<", Target #"<< mref.mTarget[0] << " " << mref.mTarget[1] << std::endl;
|
<<", Target #"<< mref.mTarget[0] << " " << mref.mTarget[1];
|
||||||
|
|
||||||
stream.clear();
|
stream.clear();
|
||||||
stream << "#" << mref.mTarget[0] << " " << mref.mTarget[1];
|
stream << "#" << mref.mTarget[0] << " " << mref.mTarget[1];
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <osg/Depth>
|
#include <osg/Depth>
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
|
@ -24,6 +23,7 @@
|
||||||
#include "../../model/world/cellcoordinates.hpp"
|
#include "../../model/world/cellcoordinates.hpp"
|
||||||
#include "../../model/prefs/state.hpp"
|
#include "../../model/prefs/state.hpp"
|
||||||
|
|
||||||
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/resource/scenemanager.hpp>
|
#include <components/resource/scenemanager.hpp>
|
||||||
#include <components/sceneutil/lightutil.hpp>
|
#include <components/sceneutil/lightutil.hpp>
|
||||||
#include <components/sceneutil/lightmanager.hpp>
|
#include <components/sceneutil/lightmanager.hpp>
|
||||||
|
@ -133,7 +133,7 @@ void CSVRender::Object::update()
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
// TODO: use error marker mesh
|
// TODO: use error marker mesh
|
||||||
std::cerr << e.what() << std::endl;
|
Log(Debug::Error) << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,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)
|
||||||
Log(Debug::Info) << "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;
|
||||||
|
@ -144,14 +144,13 @@ bool ConfigurationManager::loadConfig(const boost::filesystem::path& path,
|
||||||
boost::program_options::store(boost::program_options::parse_config_file(
|
boost::program_options::store(boost::program_options::parse_config_file(
|
||||||
configFileStream, description, true), variables);
|
configFileStream, description, true), variables);
|
||||||
|
|
||||||
if (!mSilent)
|
|
||||||
Log(Debug::Info) << "done.";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!mSilent)
|
if (!mSilent)
|
||||||
Log(Debug::Info) << "failed.";
|
Log(Debug::Error) << "Loading failed.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue