Add configurable logging backends

This commit is contained in:
James Rowe
2018-07-02 11:10:41 -06:00
committed by bunnei
parent 0d46f0df12
commit 6269a01b4e
14 changed files with 408 additions and 22 deletions

View File

@ -31,6 +31,7 @@
#include "yuzu/bootmanager.h"
#include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_dialog.h"
#include "yuzu/debugger/console.h"
#include "yuzu/debugger/graphics/graphics_breakpoints.h"
#include "yuzu/debugger/graphics/graphics_surface.h"
#include "yuzu/debugger/profiler.h"
@ -261,6 +262,7 @@ void GMainWindow::RestoreUIState() {
ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar);
statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
Debugger::ToggleConsole();
}
void GMainWindow::ConnectWidgetEvents() {
@ -906,8 +908,7 @@ void GMainWindow::UpdateUITheme() {
#endif
int main(int argc, char* argv[]) {
Log::Filter log_filter(Log::Level::Info);
Log::SetFilter(&log_filter);
Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
MicroProfileOnThreadCreate("Frontend");
SCOPE_EXIT({ MicroProfileShutdown(); });
@ -925,7 +926,12 @@ int main(int argc, char* argv[]) {
GMainWindow main_window;
// After settings have been loaded by GMainWindow, apply the filter
Log::Filter log_filter;
log_filter.ParseFilterString(Settings::values.log_filter);
Log::SetGlobalFilter(log_filter);
FileUtil::CreateFullPath(FileUtil::GetUserPath(D_LOGS_IDX));
Log::AddBackend(
std::make_unique<Log::FileBackend>(FileUtil::GetUserPath(D_LOGS_IDX) + LOG_FILE));
main_window.show();
return app.exec();