Add logger to client

pull/58/head
Koncord 8 years ago
parent 7f8c0ecbbd
commit 35991fcd15

@ -38,6 +38,7 @@ extern int is_debugger_attached(void);
#endif #endif
#include <boost/version.hpp> #include <boost/version.hpp>
#include <components/openmw-mp/Log.hpp>
/** /**
* Workaround for problems with whitespaces in paths in older versions of Boost library * Workaround for problems with whitespaces in paths in older versions of Boost library
*/ */
@ -337,6 +338,7 @@ int main(int argc, char**argv)
std::cout.rdbuf (&coutsb); std::cout.rdbuf (&coutsb);
std::cerr.rdbuf (&cerrsb); std::cerr.rdbuf (&cerrsb);
#endif #endif
LOG_INIT(Log::LOG_INFO);
#if USE_CRASH_CATCHER #if USE_CRASH_CATCHER
@ -380,6 +382,8 @@ int main(int argc, char**argv)
std::cout.rdbuf(cout_rdbuf); std::cout.rdbuf(cout_rdbuf);
std::cerr.rdbuf(cerr_rdbuf); std::cerr.rdbuf(cerr_rdbuf);
LOG_QUIT();
return ret; return ret;
} }

@ -23,6 +23,7 @@
#include <apps/openmw/mwdialogue/dialoguemanagerimp.hpp> #include <apps/openmw/mwdialogue/dialoguemanagerimp.hpp>
#include <apps/openmw/mwworld/inventorystore.hpp> #include <apps/openmw/mwworld/inventorystore.hpp>
#include <apps/openmw/mwmechanics/spellcasting.hpp> #include <apps/openmw/mwmechanics/spellcasting.hpp>
#include <components/openmw-mp/Log.hpp>
#include "DedicatedPlayer.hpp" #include "DedicatedPlayer.hpp"
#include "LocalPlayer.hpp" #include "LocalPlayer.hpp"
@ -57,7 +58,7 @@ std::string loadSettings (Settings::Manager & settings)
Main::Main() Main::Main()
{ {
std::cout << "Main::Main" << std::endl; LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "TES3MP started");
mNetworking = new Networking(); mNetworking = new Networking();
mLocalPlayer = new LocalPlayer(); mLocalPlayer = new LocalPlayer();
mGUIController = new GUIController(); mGUIController = new GUIController();
@ -69,7 +70,7 @@ Main::Main()
Main::~Main() Main::~Main()
{ {
std::cout << "Main::~Main" << std::endl; LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "TES3MP stopped");
delete mNetworking; delete mNetworking;
delete mLocalPlayer; delete mLocalPlayer;
delete mGUIController; delete mGUIController;
@ -90,6 +91,8 @@ void Main::Create()
mgr.mChangedSettings.clear(); mgr.mChangedSettings.clear();
loadSettings(mgr); loadSettings(mgr);
int logLevel = mgr.getInt("loglevel", "General");
Log::SetLevel(logLevel);
pMain->server = mgr.getString("server", "General"); pMain->server = mgr.getString("server", "General");
pMain->port = (unsigned short)mgr.getInt("port", "General"); pMain->port = (unsigned short)mgr.getInt("port", "General");

@ -1,4 +1,6 @@
[General] [General]
#0 - Verbose (spam), 1 - Info, 2 - Warnings, 3 - Errors, 4 - Only fatal errors
loglevel = 0
#master = master.tes3mp.com:8088 #master = master.tes3mp.com:8088
server = mp.tes3mp.com server = mp.tes3mp.com
port = 25565 port = 25565

Loading…
Cancel
Save