mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Add configurable per-class log filtering
This commit is contained in:
		
							parent
							
								
									0600e2d8b5
								
							
						
					
					
						commit
						0e0a007a25
					
				
					 11 changed files with 223 additions and 14 deletions
				
			
		|  | @ -52,7 +52,7 @@ void Config::ReadValues() { | |||
|     qt_config->endGroup(); | ||||
| 
 | ||||
|     qt_config->beginGroup("Miscellaneous"); | ||||
|     Settings::values.enable_log = qt_config->value("enable_log", true).toBool(); | ||||
|     Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString(); | ||||
|     qt_config->endGroup(); | ||||
| } | ||||
| 
 | ||||
|  | @ -87,7 +87,7 @@ void Config::SaveValues() { | |||
|     qt_config->endGroup(); | ||||
| 
 | ||||
|     qt_config->beginGroup("Miscellaneous"); | ||||
|     qt_config->setValue("enable_log", Settings::values.enable_log); | ||||
|     qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter)); | ||||
|     qt_config->endGroup(); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ | |||
| #include "common/logging/text_formatter.h" | ||||
| #include "common/logging/log.h" | ||||
| #include "common/logging/backend.h" | ||||
| #include "common/logging/filter.h" | ||||
| #include "common/platform.h" | ||||
| #include "common/scope_exit.h" | ||||
| 
 | ||||
|  | @ -42,14 +43,10 @@ | |||
| 
 | ||||
| GMainWindow::GMainWindow() | ||||
| { | ||||
| 
 | ||||
|     Pica::g_debug_context = Pica::DebugContext::Construct(); | ||||
| 
 | ||||
|     Config config; | ||||
| 
 | ||||
|     if (!Settings::values.enable_log) | ||||
|         LogManager::Shutdown(); | ||||
| 
 | ||||
|     ui.setupUi(this); | ||||
|     statusBar()->hide(); | ||||
| 
 | ||||
|  | @ -277,7 +274,8 @@ void GMainWindow::closeEvent(QCloseEvent* event) | |||
| int __cdecl main(int argc, char* argv[]) | ||||
| { | ||||
|     std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); | ||||
|     std::thread logging_thread(Log::TextLoggingLoop, logger); | ||||
|     Log::Filter log_filter(Log::Level::Info); | ||||
|     std::thread logging_thread(Log::TextLoggingLoop, logger, &log_filter); | ||||
|     SCOPE_EXIT({ | ||||
|         logger->Close(); | ||||
|         logging_thread.join(); | ||||
|  | @ -285,7 +283,11 @@ int __cdecl main(int argc, char* argv[]) | |||
| 
 | ||||
|     QApplication::setAttribute(Qt::AA_X11InitThreads); | ||||
|     QApplication app(argc, argv); | ||||
| 
 | ||||
|     GMainWindow main_window; | ||||
|     // After settings have been loaded by GMainWindow, apply the filter
 | ||||
|     log_filter.ParseFilterString(Settings::values.log_filter); | ||||
| 
 | ||||
|     main_window.show(); | ||||
|     return app.exec(); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue