mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-30 10:26:14 +00:00
[common/logging] Fix long logs, remove clutter on Android logcat (#4310)
Signed-off-by: lizzie <lizzie@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- logs normally are like this: ``` 08-27 02:58:48.188 12511 4743 W YuzuNative: [18534.062505] Shader <Warning> shader_recompiler/frontend/maxwell/translate/impl/move_special_register.cpp:141:Read: (STUBBED) SR_WSCALEFACTOR_XY 08-27 02:58:48.188 12511 4743 W YuzuNative: [18534.062513] Shader <Warning> shader_recompiler/frontend/maxwell/translate/impl/move_special_register.cpp:144:Read: (STUBBED) SR_WSCALEFACTOR_Z 08-27 02:58:48.188 12511 4743 W YuzuNative: [18534.062520] Shader <Warning> shader_recompiler/frontend/maxwell/translate/impl/vote.cpp:50:VOTE_vtg: (STUBBED) called 08-27 02:58:48.188 12511 4743 W YuzuNative: [18534.062523] Shader <Warning> shader_recompiler/frontend/ir/ir_emitter.cpp:267:GetFlowTest: (STUBBED) FCSM_TR ``` bunch of redundant info imo instead they should just be ``` 08-27 02:58:48.188 12511 4743 W YuzuNative: Shader shader_recompiler/frontend/maxwell/translate/impl/move_special_register.cpp:141:Read: (STUBBED) SR_WSCALEFACTOR_XY 08-27 02:58:48.188 12511 4743 W YuzuNative: Shader shader_recompiler/frontend/maxwell/translate/impl/move_special_register.cpp:144:Read: (STUBBED) SR_WSCALEFACTOR_Z 08-27 02:58:48.188 12511 4743 W YuzuNative: Shader shader_recompiler/frontend/maxwell/translate/impl/vote.cpp:50:VOTE_vtg: (STUBBED) called 08-27 02:58:48.188 12511 4743 W YuzuNative: Shader shader_recompiler/frontend/ir/ir_emitter.cpp:267:GetFlowTest: (STUBBED) FCSM_TR ``` Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4310 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
This commit is contained in:
+27
-15
@@ -329,7 +329,7 @@ struct LogcatBackend : public Backend {
|
||||
}
|
||||
}();
|
||||
auto const df = GetDirectFormatArgs(entry);
|
||||
__android_log_print(android_log_priority, "YuzuNative", CCB_PRINTF_FMT, df.time_seconds, df.time_fractional, df.class_name, df.level_name, entry.filename, entry.line_num, entry.function, entry.message);
|
||||
__android_log_print(android_log_priority, "YuzuNative", "%s %s:%u:%s: %s", df.class_name, entry.filename, entry.line_num, entry.function, entry.message);
|
||||
}
|
||||
void Flush() noexcept override {}
|
||||
};
|
||||
@@ -428,21 +428,33 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, u
|
||||
auto const flush = ::Settings::values.log_flush_line.GetValue();
|
||||
char buffer[BUFSIZ];
|
||||
auto result = fmt::vformat_to_n(buffer, sizeof(buffer) - 1, format, args);
|
||||
buffer[(std::min)(result.size, sizeof(buffer) - 1)] = '\0';
|
||||
logging_instance->ForEachBackend([=](Backend& backend) {
|
||||
backend.Write(Entry{
|
||||
.message = buffer,
|
||||
.message_len = (std::min)(result.size, sizeof(buffer) - 1),
|
||||
.timestamp = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - logging_instance->time_origin),
|
||||
.log_class = log_class,
|
||||
.log_level = log_level,
|
||||
.filename = TrimSourcePath(filename),
|
||||
.function = function,
|
||||
.line_num = line_num,
|
||||
Entry e{
|
||||
.message = nullptr,
|
||||
.message_len = 0,
|
||||
.timestamp = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - logging_instance->time_origin),
|
||||
.log_class = log_class,
|
||||
.log_level = log_level,
|
||||
.filename = TrimSourcePath(filename),
|
||||
.function = function,
|
||||
.line_num = line_num,
|
||||
};
|
||||
if (result.size <= sizeof(buffer) - 1) {
|
||||
buffer[(std::min)(result.size, sizeof(buffer) - 1)] = '\0';
|
||||
e.message = buffer;
|
||||
e.message_len = (std::min)(result.size, sizeof(buffer) - 1);
|
||||
logging_instance->ForEachBackend([=](Backend& backend) {
|
||||
backend.Write(e);
|
||||
if (flush) backend.Flush();
|
||||
});
|
||||
if (flush)
|
||||
backend.Flush();
|
||||
});
|
||||
} else {
|
||||
std::string s = fmt::vformat(format, args);
|
||||
e.message = s.c_str();
|
||||
e.message_len = s.size();
|
||||
logging_instance->ForEachBackend([=](Backend& backend) {
|
||||
backend.Write(e);
|
||||
if (flush) backend.Flush();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace Common::Log
|
||||
|
||||
@@ -126,9 +126,9 @@ void LogSettings() {
|
||||
setting->UsingGlobal() ? '-' : 'C', TranslateCategory(category),
|
||||
setting->GetLabel());
|
||||
if (is_default)
|
||||
settings_list.push_back(fmt::format("{}: {}\n", name, setting->Canonicalize()));
|
||||
settings_list.push_back(fmt::format("{}: {}", name, setting->Canonicalize()));
|
||||
else
|
||||
settings_list.push_front(fmt::format("{}: {}\n", name, setting->Canonicalize()));
|
||||
settings_list.push_front(fmt::format("{}: {}", name, setting->Canonicalize()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user