mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 23:15:41 +00:00
Merge branch 'logging2' into 'master'
Print '--version' and '--help' messages without timestamps Closes #2686 See merge request OpenMW/openmw!444
This commit is contained in:
commit
15f03ae375
4 changed files with 15 additions and 2 deletions
|
@ -73,6 +73,7 @@
|
||||||
Feature #390: 3rd person look "over the shoulder"
|
Feature #390: 3rd person look "over the shoulder"
|
||||||
Feature #2386: Distant Statics in the form of Object Paging
|
Feature #2386: Distant Statics in the form of Object Paging
|
||||||
Feature #2404: Levelled List can not be placed into a container
|
Feature #2404: Levelled List can not be placed into a container
|
||||||
|
Feature #2686: Timestamps in openmw.log
|
||||||
Feature #4894: Consider actors as obstacles for pathfinding
|
Feature #4894: Consider actors as obstacles for pathfinding
|
||||||
Feature #5043: Head Bobbing
|
Feature #5043: Head Bobbing
|
||||||
Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher
|
Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher
|
||||||
|
|
|
@ -135,7 +135,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
|
|
||||||
if (variables.count ("help"))
|
if (variables.count ("help"))
|
||||||
{
|
{
|
||||||
std::cout << desc << std::endl;
|
getRawStdout() << desc << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
cfgMgr.readConfiguration(variables, desc, true);
|
cfgMgr.readConfiguration(variables, desc, true);
|
||||||
|
|
||||||
Version::Version v = Version::getOpenmwVersion(variables["resources"].as<Files::EscapePath>().mPath.string());
|
Version::Version v = Version::getOpenmwVersion(variables["resources"].as<Files::EscapePath>().mPath.string());
|
||||||
std::cout << v.describe() << std::endl;
|
getRawStdout() << v.describe() << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "debugging.hpp"
|
#include "debugging.hpp"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <components/crashcatcher/crashcatcher.hpp>
|
#include <components/crashcatcher/crashcatcher.hpp>
|
||||||
|
|
||||||
|
@ -133,11 +134,19 @@ namespace Debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::unique_ptr<std::ostream> rawStdout = nullptr;
|
||||||
|
|
||||||
|
std::ostream& getRawStdout()
|
||||||
|
{
|
||||||
|
return rawStdout ? *rawStdout : std::cout;
|
||||||
|
}
|
||||||
|
|
||||||
int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, char *argv[], const std::string& appName)
|
int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, char *argv[], const std::string& appName)
|
||||||
{
|
{
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
(void)Debug::attachParentConsole();
|
(void)Debug::attachParentConsole();
|
||||||
#endif
|
#endif
|
||||||
|
rawStdout = std::make_unique<std::ostream>(std::cout.rdbuf());
|
||||||
|
|
||||||
// Some objects used to redirect cout and cerr
|
// Some objects used to redirect cout and cerr
|
||||||
// Scope must be here, so this still works inside the catch block for logging exceptions
|
// Scope must be here, so this still works inside the catch block for logging exceptions
|
||||||
|
|
|
@ -135,6 +135,9 @@ namespace Debug
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can be used to print messages without timestamps
|
||||||
|
std::ostream& getRawStdout();
|
||||||
|
|
||||||
int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, char *argv[], const std::string& appName);
|
int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, char *argv[], const std::string& appName);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue