Use new logging system for editor

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

@ -5,8 +5,8 @@
#include <QLocalSocket>
#include <QMessageBox>
#include <components/debug/debuglog.hpp>
#include <components/fallback/validate.hpp>
#include <components/nifosg/nifloader.hpp>
#include "model/doc/document.hpp"
@ -294,7 +294,7 @@ bool CS::Editor::makeIPCServer()
mLock = boost::interprocess::file_lock(mPid.string().c_str());
if(!mLock.try_lock())
{
std::cerr << "OpenCS already running." << std::endl;
Log(Debug::Error) << "Error: OpenMW-CS is already running.";
return false;
}
@ -317,17 +317,17 @@ bool CS::Editor::makeIPCServer()
if(boost::filesystem::exists(fullPath.toUtf8().constData()))
{
// 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
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)
{
std::cerr << "ERROR " << e.what() << std::endl;
Log(Debug::Error) << "Error: " << e.what();
return false;
}

@ -1,7 +1,6 @@
#include "editor.hpp"
#include <exception>
#include <iostream>
#include <string>
#include <QApplication>
@ -31,7 +30,7 @@ class Application : public QApplication
}
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;

@ -2,7 +2,6 @@
#include <cassert>
#include <fstream>
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
@ -13,6 +12,8 @@
#include <components/files/configurationmanager.hpp>
#endif
#include <components/debug/debuglog.hpp>
void CSMDoc::Document::addGmsts()
{
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)
{
/// \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)

@ -1,8 +1,8 @@
#include "refcollection.hpp"
#include <sstream>
#include <iostream>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp>
#include <components/esm/loadcell.hpp>
@ -58,10 +58,10 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
// message
if (index.first != mref.mTarget[0] || index.second != mref.mTarget[1])
{
std::cerr << "The Position of moved ref "
<< ref.mRefID << " does not match the target cell" << std::endl;
std::cerr << "Position: #" << index.first << " " << index.second
<<", Target #"<< mref.mTarget[0] << " " << mref.mTarget[1] << std::endl;
Log(Debug::Warning) << "Warning: the Position of moved ref "
<< ref.mRefID << " does not match the target cell";
Log(Debug::Warning) << "Position: #" << index.first << " " << index.second
<<", Target #"<< mref.mTarget[0] << " " << mref.mTarget[1];
stream.clear();
stream << "#" << mref.mTarget[0] << " " << mref.mTarget[1];

@ -1,7 +1,6 @@
#include "object.hpp"
#include <stdexcept>
#include <iostream>
#include <osg/Depth>
#include <osg/Group>
@ -24,6 +23,7 @@
#include "../../model/world/cellcoordinates.hpp"
#include "../../model/prefs/state.hpp"
#include <components/debug/debuglog.hpp>
#include <components/resource/scenemanager.hpp>
#include <components/sceneutil/lightutil.hpp>
#include <components/sceneutil/lightmanager.hpp>
@ -133,7 +133,7 @@ void CSVRender::Object::update()
catch (std::exception& e)
{
// 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 (!mSilent)
Log(Debug::Info) << "Loading config file: " << cfgFile.string() << "... ";
Log(Debug::Info) << "Loading config file: " << cfgFile.string();
boost::filesystem::ifstream configFileStreamUnfiltered(cfgFile);
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(
configFileStream, description, true), variables);
if (!mSilent)
Log(Debug::Info) << "done.";
return true;
}
else
{
if (!mSilent)
Log(Debug::Info) << "failed.";
Log(Debug::Error) << "Loading failed.";
return false;
}
}

Loading…
Cancel
Save