summaryrefslogtreecommitdiffstats
path: root/src/core/reporter.cpp
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-06-13 10:30:54 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-06-16 06:06:02 +0200
commit0f48292de19227fcc61dd9ea71be321824368f9e (patch)
tree35a6d30abdc9435973116d145ff4db3a7ec22a54 /src/core/reporter.cpp
parentMerge pull request #6470 from ameerj/lm-silence (diff)
downloadyuzu-0f48292de19227fcc61dd9ea71be321824368f9e.tar
yuzu-0f48292de19227fcc61dd9ea71be321824368f9e.tar.gz
yuzu-0f48292de19227fcc61dd9ea71be321824368f9e.tar.bz2
yuzu-0f48292de19227fcc61dd9ea71be321824368f9e.tar.lz
yuzu-0f48292de19227fcc61dd9ea71be321824368f9e.tar.xz
yuzu-0f48292de19227fcc61dd9ea71be321824368f9e.tar.zst
yuzu-0f48292de19227fcc61dd9ea71be321824368f9e.zip
Diffstat (limited to 'src/core/reporter.cpp')
-rw-r--r--src/core/reporter.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp
index ec2a16e62..82b0f535a 100644
--- a/src/core/reporter.cpp
+++ b/src/core/reporter.cpp
@@ -195,7 +195,9 @@ json GetHLERequestContextData(Kernel::HLERequestContext& ctx, Core::Memory::Memo
namespace Core {
-Reporter::Reporter(System& system_) : system(system_) {}
+Reporter::Reporter(System& system_) : system(system_) {
+ ClearFSAccessLog();
+}
Reporter::~Reporter() = default;
@@ -362,22 +364,12 @@ void Reporter::SaveErrorReport(u64 title_id, ResultCode result,
SaveToFile(std::move(out), GetPath("error_report", title_id, timestamp));
}
-void Reporter::SaveFilesystemAccessReport(Service::FileSystem::LogMode log_mode,
- std::string log_message) const {
- if (!IsReportingEnabled())
- return;
-
- const auto timestamp = GetTimestamp();
- const auto title_id = system.CurrentProcess()->GetTitleID();
- json out;
+void Reporter::SaveFSAccessLog(std::string_view log_message) const {
+ const auto access_log_path =
+ Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir) / "FsAccessLog.txt";
- out["yuzu_version"] = GetYuzuVersionData();
- out["report_common"] = GetReportCommonData(title_id, ResultSuccess, timestamp);
-
- out["log_mode"] = fmt::format("{:08X}", static_cast<u32>(log_mode));
- out["log_message"] = std::move(log_message);
-
- SaveToFile(std::move(out), GetPath("filesystem_access_report", title_id, timestamp));
+ void(Common::FS::AppendStringToFile(access_log_path, Common::FS::FileType::TextFile,
+ log_message));
}
void Reporter::SaveUserReport() const {
@@ -392,6 +384,18 @@ void Reporter::SaveUserReport() const {
GetPath("user_report", title_id, timestamp));
}
+void Reporter::ClearFSAccessLog() const {
+ const auto access_log_path =
+ Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir) / "FsAccessLog.txt";
+
+ Common::FS::IOFile access_log_file{access_log_path, Common::FS::FileAccessMode::Write,
+ Common::FS::FileType::TextFile};
+
+ if (!access_log_file.IsOpen()) {
+ LOG_ERROR(Common_Filesystem, "Failed to clear the filesystem access log.");
+ }
+}
+
bool Reporter::IsReportingEnabled() const {
return Settings::values.reporting_services;
}