Merge pull request #6638 from GPUCode/new-log

common: Backport yuzu log improvements
This commit is contained in:
GPUCode 2023-07-06 23:44:54 +03:00 committed by GitHub
commit 4ccd9f24fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 1201 additions and 750 deletions

View file

@ -174,23 +174,11 @@ static void OnStatusMessageReceived(const Network::StatusMessageEntry& msg) {
std::cout << std::endl << "* " << message << std::endl << std::endl;
}
static void InitializeLogging() {
Log::Filter log_filter(Log::Level::Debug);
log_filter.ParseFilterString(Settings::values.log_filter.GetValue());
Log::SetGlobalFilter(log_filter);
Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
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));
#ifdef _WIN32
Log::AddBackend(std::make_unique<Log::DebuggerBackend>());
#endif
}
/// Application entry point
int main(int argc, char** argv) {
Common::Log::Initialize();
Common::Log::SetColorConsoleBackendEnabled(true);
Common::Log::Start();
Common::DetachedTasks detached_tasks;
Config config;
int option_index = 0;
@ -201,8 +189,6 @@ int main(int argc, char** argv) {
std::string movie_play;
std::string dump_video;
InitializeLogging();
char* endarg;
#ifdef _WIN32
int argc_w;
@ -357,7 +343,7 @@ int main(int argc, char** argv) {
// Apply the command line arguments
Settings::values.gdbstub_port = gdb_port;
Settings::values.use_gdbstub = use_gdbstub;
Settings::Apply();
system.ApplySettings();
// Register frontend applets
Frontend::RegisterDefaultApplets();

View file

@ -11,8 +11,8 @@
#include "citra/config.h"
#include "citra/default_ini.h"
#include "common/file_util.h"
#include "common/logging/backend.h"
#include "common/logging/log.h"
#include "common/param_package.h"
#include "common/settings.h"
#include "core/hle/service/service.h"
#include "input_common/main.h"
@ -299,6 +299,12 @@ void Config::ReadValues() {
// Miscellaneous
ReadSetting("Miscellaneous", Settings::values.log_filter);
// Apply the log_filter setting as the logger has already been initialized
// and doesn't pick up the filter on its own.
Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue());
Common::Log::SetGlobalFilter(filter);
// Debugging
Settings::values.record_frame_times =
sdl2_config->GetBoolean("Debugging", "record_frame_times", false);