mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
Emu: make "Silence All Logs" dynamic
This commit is contained in:
parent
d6b8213c9f
commit
fc3a134e7d
7 changed files with 51 additions and 16 deletions
|
@ -344,12 +344,7 @@ void cfg::set_entry::from_default()
|
||||||
|
|
||||||
void cfg::log_entry::set_map(std::map<std::string, logs::level>&& map)
|
void cfg::log_entry::set_map(std::map<std::string, logs::level>&& map)
|
||||||
{
|
{
|
||||||
logs::reset();
|
m_map = std::move(map);
|
||||||
|
|
||||||
for (auto&& pair : (m_map = std::move(map)))
|
|
||||||
{
|
|
||||||
logs::set_level(pair.first, pair.second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cfg::log_entry::from_default()
|
void cfg::log_entry::from_default()
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "../Crypto/unself.h"
|
#include "../Crypto/unself.h"
|
||||||
#include "../Crypto/unpkg.h"
|
#include "../Crypto/unpkg.h"
|
||||||
#include "util/yaml.hpp"
|
#include "util/yaml.hpp"
|
||||||
|
#include "util/logs.hpp"
|
||||||
|
|
||||||
#include "cereal/archives/binary.hpp"
|
#include "cereal/archives/binary.hpp"
|
||||||
|
|
||||||
|
@ -1528,11 +1529,7 @@ void Emulator::Run(bool start_playtime)
|
||||||
m_pause_amend_time = 0;
|
m_pause_amend_time = 0;
|
||||||
m_state = system_state::running;
|
m_state = system_state::running;
|
||||||
|
|
||||||
if (g_cfg.misc.silence_all_logs)
|
ConfigureLogs();
|
||||||
{
|
|
||||||
sys_log.notice("Now disabling logging...");
|
|
||||||
logs::silence();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto on_select = [](u32, cpu_thread& cpu)
|
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);
|
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 <>
|
template <>
|
||||||
void stx::manual_fixed_typemap<void>::init_reporter(const char* name, unsigned long long created) const noexcept
|
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 BootRsxCapture(const std::string& path);
|
||||||
bool InstallPkg(const std::string& path);
|
bool InstallPkg(const std::string& path);
|
||||||
|
|
||||||
private:
|
|
||||||
void LimitCacheSize();
|
|
||||||
|
|
||||||
public:
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static std::string GetExeDir();
|
static std::string GetExeDir();
|
||||||
#endif
|
#endif
|
||||||
|
@ -214,6 +210,11 @@ public:
|
||||||
std::string GetFormattedTitle(double fps) const;
|
std::string GetFormattedTitle(double fps) const;
|
||||||
|
|
||||||
u32 GetMaxThreads() const;
|
u32 GetMaxThreads() const;
|
||||||
|
|
||||||
|
void ConfigureLogs();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void LimitCacheSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Emulator Emu;
|
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 show_shader_compilation_hint{ this, "Show shader compilation hint", true, true };
|
||||||
cfg::_bool use_native_interface{ this, "Use native user interface", 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::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 };
|
cfg::string title_format{ this, "Window Title Format", "FPS: %F | %R | %V | %T [%t]", true };
|
||||||
|
|
||||||
} misc{ this };
|
} misc{ this };
|
||||||
|
|
|
@ -427,6 +427,7 @@ void gui_application::OnChangeStyleSheetRequest(const QString& path)
|
||||||
|
|
||||||
void gui_application::OnEmuSettingsChange()
|
void gui_application::OnEmuSettingsChange()
|
||||||
{
|
{
|
||||||
|
Emu.ConfigureLogs();
|
||||||
rsx::overlays::reset_performance_overlay();
|
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> get_channels()
|
||||||
{
|
{
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -132,6 +133,9 @@ namespace logs
|
||||||
// Log level control: get channel level
|
// Log level control: get channel level
|
||||||
level get_level(const std::string&);
|
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
|
// Get all registered log channels
|
||||||
std::vector<std::string> get_channels();
|
std::vector<std::string> get_channels();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue