mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-06 08:15:00 -06:00
Common: Restore old log filter behavior (#4336)
* Restore old log filter behavior Not sure exactly why this hadn't happened yet. * Suggested change * Update documentation to include changes * Remove mention of debug log class Debug is both a valid class and level, kinda confusing to use it as an example in my opinion. * Error instead of assert * Missing include
This commit is contained in:
parent
5bfec866b1
commit
e7d571c8da
@ -64,13 +64,13 @@ You can configure the emulator by editing the `config.toml` file found in the `u
|
|||||||
- It can be beneficial to set this to `false` for better performance.
|
- It can be beneficial to set this to `false` for better performance.
|
||||||
- When communicating about issues with games and the log messages aren't clear due to potentially confusing order, set this to `true` and send that log instead.
|
- When communicating about issues with games and the log messages aren't clear due to potentially confusing order, set this to `true` and send that log instead.
|
||||||
- `filter`: Sets the logging category for various logging classes.
|
- `filter`: Sets the logging category for various logging classes.
|
||||||
- Format: `<class>=<level>,...`
|
- Format: `<class>:<level> ...`
|
||||||
- Multiple classes can be set by separating them with a comma. (example: `Render=warning,Debug=critical,Lib.Pad=error`)
|
- Multiple classes can be set by separating them with a space. (example: `Render:Warning Lib.Pad:Error`)
|
||||||
- Sub-classes can be specified in the same format as seen in the console/log (such as `Core.Linker`).
|
- Sub-classes can be specified in the same format as seen in the console/log (such as `Core.Linker`).
|
||||||
- Valid log levels: `trace, debug, info, warning, error, critical` - in this order, setting a level silences all levels preceding it and logs every level after it.
|
- Valid log levels: `trace, debug, info, warning, error, critical, off` - in this order, setting a level silences all levels preceding it and logs every level after it.
|
||||||
- Examples:
|
- Examples:
|
||||||
- If the log is being spammed with messages coming from Lib.Pad, you can use `Lib.Pad=critical` to only log critical-level messages.
|
- If the log is being spammed with messages coming from Lib.Pad, you can use `Lib.Pad:Critical` to only log critical-level messages.
|
||||||
- If you'd like to mute everything, but still want to receive messages from Vulkan rendering: `off,Render.Vulkan=info` (if you want critical at least `critical,Render.Vulkan=info`)
|
- If you'd like to mute everything, but still want to receive messages from Vulkan rendering: `*:Off Render.Vulkan:Info` (if you want critical at least `*:Critical Render.Vulkan:Info`)
|
||||||
- `skipDuplicate`: Skip same lines with a `Skipped N duplicate messages..` message (`true`/`false`)
|
- `skipDuplicate`: Skip same lines with a `Skipped N duplicate messages..` message (`true`/`false`)
|
||||||
- By default, the emulator will skip same lines for `maxSkipDuration` milliseconds.
|
- By default, the emulator will skip same lines for `maxSkipDuration` milliseconds.
|
||||||
- `append`: Append log to the existing file (`true`/`false`)
|
- `append`: Append log to the existing file (`true`/`false`)
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
@ -200,12 +201,17 @@ void Setup(std::string_view log_filename) {
|
|||||||
std::unordered_map<std::string, spdlog::level> log_level_per_class;
|
std::unordered_map<std::string, spdlog::level> log_level_per_class;
|
||||||
|
|
||||||
if (EmulatorSettings.IsLogEnable()) {
|
if (EmulatorSettings.IsLogEnable()) {
|
||||||
for (const auto class_level : std::views::split(EmulatorSettings.GetLogFilter(), ',')) {
|
for (const auto class_level : std::views::split(EmulatorSettings.GetLogFilter(), ' ')) {
|
||||||
const auto class_level_pair =
|
const auto class_level_pair =
|
||||||
std::views::split(class_level, '=') | std::ranges::to<std::vector<std::string>>();
|
std::views::split(class_level, ':') | std::ranges::to<std::vector<std::string>>();
|
||||||
|
|
||||||
if (class_level_pair.size() == 1) {
|
if (class_level_pair.size() != 2) {
|
||||||
default_log_level = spdlog::level_from_str(class_level_pair.front() |
|
std::cerr << "bad log filter provided" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (class_level_pair.front()[0] == '*') {
|
||||||
|
default_log_level = spdlog::level_from_str(class_level_pair.back() |
|
||||||
std::ranges::to<std::string>());
|
std::ranges::to<std::string>());
|
||||||
} else {
|
} else {
|
||||||
log_level_per_class[class_level_pair.front() | std::ranges::to<std::string>()] =
|
log_level_per_class[class_level_pair.front() | std::ranges::to<std::string>()] =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user