mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-01 04:51:49 +01:00
Emu: make "Silence All Logs" dynamic
This commit is contained in:
parent
d6b8213c9f
commit
fc3a134e7d
@ -344,12 +344,7 @@ void cfg::set_entry::from_default()
|
||||
|
||||
void cfg::log_entry::set_map(std::map<std::string, logs::level>&& map)
|
||||
{
|
||||
logs::reset();
|
||||
|
||||
for (auto&& pair : (m_map = std::move(map)))
|
||||
{
|
||||
logs::set_level(pair.first, pair.second);
|
||||
}
|
||||
m_map = std::move(map);
|
||||
}
|
||||
|
||||
void cfg::log_entry::from_default()
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "../Crypto/unself.h"
|
||||
#include "../Crypto/unpkg.h"
|
||||
#include "util/yaml.hpp"
|
||||
#include "util/logs.hpp"
|
||||
|
||||
#include "cereal/archives/binary.hpp"
|
||||
|
||||
@ -1528,11 +1529,7 @@ void Emulator::Run(bool start_playtime)
|
||||
m_pause_amend_time = 0;
|
||||
m_state = system_state::running;
|
||||
|
||||
if (g_cfg.misc.silence_all_logs)
|
||||
{
|
||||
sys_log.notice("Now disabling logging...");
|
||||
logs::silence();
|
||||
}
|
||||
ConfigureLogs();
|
||||
|
||||
auto on_select = [](u32, cpu_thread& cpu)
|
||||
{
|
||||
@ -1822,6 +1819,35 @@ s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_i
|
||||
return static_cast<s32>(arg);
|
||||
}
|
||||
|
||||
void Emulator::ConfigureLogs()
|
||||
{
|
||||
static bool was_silenced = false;
|
||||
|
||||
const bool silenced = g_cfg.misc.silence_all_logs.get();
|
||||
|
||||
if (silenced)
|
||||
{
|
||||
if (!was_silenced)
|
||||
{
|
||||
sys_log.notice("Disabling logging...");
|
||||
}
|
||||
|
||||
logs::silence();
|
||||
}
|
||||
else
|
||||
{
|
||||
logs::reset();
|
||||
logs::set_channel_levels(g_cfg.log.get_map());
|
||||
|
||||
if (was_silenced)
|
||||
{
|
||||
sys_log.notice("Logging enabled");
|
||||
}
|
||||
}
|
||||
|
||||
was_silenced = silenced;
|
||||
}
|
||||
|
||||
template <>
|
||||
void stx::manual_fixed_typemap<void>::init_reporter(const char* name, unsigned long long created) const noexcept
|
||||
{
|
||||
|
@ -175,10 +175,6 @@ public:
|
||||
bool BootRsxCapture(const std::string& path);
|
||||
bool InstallPkg(const std::string& path);
|
||||
|
||||
private:
|
||||
void LimitCacheSize();
|
||||
|
||||
public:
|
||||
#ifdef _WIN32
|
||||
static std::string GetExeDir();
|
||||
#endif
|
||||
@ -214,6 +210,11 @@ public:
|
||||
std::string GetFormattedTitle(double fps) const;
|
||||
|
||||
u32 GetMaxThreads() const;
|
||||
|
||||
void ConfigureLogs();
|
||||
|
||||
private:
|
||||
void LimitCacheSize();
|
||||
};
|
||||
|
||||
extern Emulator Emu;
|
||||
|
@ -264,7 +264,7 @@ struct cfg_root : cfg::node
|
||||
cfg::_bool show_shader_compilation_hint{ this, "Show shader compilation hint", true, true };
|
||||
cfg::_bool use_native_interface{ this, "Use native user interface", true };
|
||||
cfg::string gdb_server{ this, "GDB Server", "127.0.0.1:2345" };
|
||||
cfg::_bool silence_all_logs{ this, "Silence All Logs", false, false };
|
||||
cfg::_bool silence_all_logs{ this, "Silence All Logs", false, true };
|
||||
cfg::string title_format{ this, "Window Title Format", "FPS: %F | %R | %V | %T [%t]", true };
|
||||
|
||||
} misc{ this };
|
||||
|
@ -427,6 +427,7 @@ void gui_application::OnChangeStyleSheetRequest(const QString& path)
|
||||
|
||||
void gui_application::OnEmuSettingsChange()
|
||||
{
|
||||
Emu.ConfigureLogs();
|
||||
rsx::overlays::reset_performance_overlay();
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,14 @@ namespace logs
|
||||
}
|
||||
}
|
||||
|
||||
void set_channel_levels(const std::map<std::string, logs::level>& map)
|
||||
{
|
||||
for (auto&& pair : map)
|
||||
{
|
||||
logs::set_level(pair.first, pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> get_channels()
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -132,6 +133,9 @@ namespace logs
|
||||
// Log level control: get channel level
|
||||
level get_level(const std::string&);
|
||||
|
||||
// Log level control: set specific channels to level::fatal
|
||||
void set_channel_levels(const std::map<std::string, logs::level>& map);
|
||||
|
||||
// Get all registered log channels
|
||||
std::vector<std::string> get_channels();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user