1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 19:21:04 +00:00

Use OpenMW logging levels for MyGUI log (feature 7130)

This commit is contained in:
Andrei Kortunov 2023-01-06 16:01:30 +04:00
parent 7f117a28c8
commit b217d1fc36
3 changed files with 17 additions and 1 deletions

View File

@ -37,6 +37,7 @@
Feature #6995: Localize the "show effect duration" option Feature #6995: Localize the "show effect duration" option
Feature #7058: Implement TestModels (T3D) console command Feature #7058: Implement TestModels (T3D) console command
Feature #7087: Block resolution change in the Windowed Fullscreen mode Feature #7087: Block resolution change in the Windowed Fullscreen mode
Feature #7130: Ability to set MyGUI logging verbosity
0.48.0 0.48.0
------ ------

View File

@ -37,4 +37,17 @@ namespace osgMyGUI
<< separator << _line << std::endl; << separator << _line << std::endl;
} }
} }
MyGUI::LogLevel LogFacility::getCurrentLogLevel() const
{
switch (Debug::CurrentDebugLevel)
{
case Debug::Error:
return MyGUI::LogLevel::Error;
case Debug::Warning:
return MyGUI::LogLevel::Warning;
default:
return MyGUI::LogLevel::Info;
}
}
} }

View File

@ -47,12 +47,14 @@ namespace osgMyGUI
MyGUI::LevelLogFilter mFilter; MyGUI::LevelLogFilter mFilter;
MyGUI::LogSource mSource; MyGUI::LogSource mSource;
MyGUI::LogLevel getCurrentLogLevel() const;
public: public:
LogFacility(const std::filesystem::path& output, bool console) LogFacility(const std::filesystem::path& output, bool console)
: mFile(output) : mFile(output)
{ {
mConsole.setEnabled(console); mConsole.setEnabled(console);
mFilter.setLoggingLevel(MyGUI::LogLevel::Info); mFilter.setLoggingLevel(getCurrentLogLevel());
mSource.addLogListener(&mFile); mSource.addLogListener(&mFile);
mSource.addLogListener(&mConsole); mSource.addLogListener(&mConsole);