Просмотр исходного кода

Port #4013 from Citra: "Init logging sooner so we dont miss some logs on startup" (#1142)

* Port #4013 from Citra: "Init logging sooner so we dont miss some logs on startup"

* Fix compilation
Tobias 8 лет назад
Родитель
Сommit
165c23c848
1 измененных файлов с 11 добавлено и 11 удалено
  1. 11 11
      src/yuzu/main.cpp

+ 11 - 11
src/yuzu/main.cpp

@@ -91,9 +91,20 @@ void GMainWindow::ShowCallouts() {}
 
 
 const int GMainWindow::max_recent_files_item;
 const int GMainWindow::max_recent_files_item;
 
 
+static void InitializeLogging() {
+    Log::Filter log_filter;
+    log_filter.ParseFilterString(Settings::values.log_filter);
+    Log::SetGlobalFilter(log_filter);
+
+    const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
+    FileUtil::CreateFullPath(log_dir);
+    Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE));
+}
+
 GMainWindow::GMainWindow()
 GMainWindow::GMainWindow()
     : config(new Config()), emu_thread(nullptr),
     : config(new Config()), emu_thread(nullptr),
       vfs(std::make_shared<FileSys::RealVfsFilesystem>()) {
       vfs(std::make_shared<FileSys::RealVfsFilesystem>()) {
+    InitializeLogging();
 
 
     debug_context = Tegra::DebugContext::Construct();
     debug_context = Tegra::DebugContext::Construct();
 
 
@@ -1173,16 +1184,6 @@ void GMainWindow::UpdateUITheme() {
 #undef main
 #undef main
 #endif
 #endif
 
 
-static void InitializeLogging() {
-    Log::Filter log_filter;
-    log_filter.ParseFilterString(Settings::values.log_filter);
-    Log::SetGlobalFilter(log_filter);
-
-    const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
-    FileUtil::CreateFullPath(log_dir);
-    Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE));
-}
-
 int main(int argc, char* argv[]) {
 int main(int argc, char* argv[]) {
     MicroProfileOnThreadCreate("Frontend");
     MicroProfileOnThreadCreate("Frontend");
     SCOPE_EXIT({ MicroProfileShutdown(); });
     SCOPE_EXIT({ MicroProfileShutdown(); });
@@ -1200,7 +1201,6 @@ int main(int argc, char* argv[]) {
 
 
     GMainWindow main_window;
     GMainWindow main_window;
     // After settings have been loaded by GMainWindow, apply the filter
     // After settings have been loaded by GMainWindow, apply the filter
-    InitializeLogging();
     main_window.show();
     main_window.show();
     return app.exec();
     return app.exec();
 }
 }