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
#include <boost/version.hpp>
#include <components/openmw-mp/Log.hpp>
/**
* 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::cerr.rdbuf (&cerrsb);
#endif
LOG_INIT(Log::LOG_INFO);
#if USE_CRASH_CATCHER
@ -380,6 +382,8 @@ int main(int argc, char**argv)
std::cout.rdbuf(cout_rdbuf);
std::cerr.rdbuf(cerr_rdbuf);
LOG_QUIT();
return ret;
}

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

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

Loading…
Cancel
Save