From b217d1fc3661cd83daf43b965ef19977066702d4 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 6 Jan 2023 16:01:30 +0400 Subject: [PATCH] Use OpenMW logging levels for MyGUI log (feature 7130) --- CHANGELOG.md | 1 + components/myguiplatform/myguiloglistener.cpp | 13 +++++++++++++ components/myguiplatform/myguiloglistener.hpp | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f81c6f235..2d12db3850 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Feature #6995: Localize the "show effect duration" option Feature #7058: Implement TestModels (T3D) console command Feature #7087: Block resolution change in the Windowed Fullscreen mode + Feature #7130: Ability to set MyGUI logging verbosity 0.48.0 ------ diff --git a/components/myguiplatform/myguiloglistener.cpp b/components/myguiplatform/myguiloglistener.cpp index 9002d390f5..42dc9c0415 100644 --- a/components/myguiplatform/myguiloglistener.cpp +++ b/components/myguiplatform/myguiloglistener.cpp @@ -37,4 +37,17 @@ namespace osgMyGUI << 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; + } + } } diff --git a/components/myguiplatform/myguiloglistener.hpp b/components/myguiplatform/myguiloglistener.hpp index ec8bd16578..1af63a397f 100644 --- a/components/myguiplatform/myguiloglistener.hpp +++ b/components/myguiplatform/myguiloglistener.hpp @@ -47,12 +47,14 @@ namespace osgMyGUI MyGUI::LevelLogFilter mFilter; MyGUI::LogSource mSource; + MyGUI::LogLevel getCurrentLogLevel() const; + public: LogFacility(const std::filesystem::path& output, bool console) : mFile(output) { mConsole.setEnabled(console); - mFilter.setLoggingLevel(MyGUI::LogLevel::Info); + mFilter.setLoggingLevel(getCurrentLogLevel()); mSource.addLogListener(&mFile); mSource.addLogListener(&mConsole);