summaryrefslogtreecommitdiffstats
path: root/src/common/logging
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2021-04-20 18:57:45 +0200
committerLioncash <mathew1800@gmail.com>2021-04-20 18:57:49 +0200
commit6125590a7b2bbad7d5efdfbab69ba86601e0769b (patch)
treec420bcf8709cf5af735988fddf25bba63ddbd2eb /src/common/logging
parentlog/backend: Make use of erase_if (diff)
downloadyuzu-6125590a7b2bbad7d5efdfbab69ba86601e0769b.tar
yuzu-6125590a7b2bbad7d5efdfbab69ba86601e0769b.tar.gz
yuzu-6125590a7b2bbad7d5efdfbab69ba86601e0769b.tar.bz2
yuzu-6125590a7b2bbad7d5efdfbab69ba86601e0769b.tar.lz
yuzu-6125590a7b2bbad7d5efdfbab69ba86601e0769b.tar.xz
yuzu-6125590a7b2bbad7d5efdfbab69ba86601e0769b.tar.zst
yuzu-6125590a7b2bbad7d5efdfbab69ba86601e0769b.zip
Diffstat (limited to 'src/common/logging')
-rw-r--r--src/common/logging/backend.cpp10
-rw-r--r--src/common/logging/backend.h4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index f0bb392c6..96efa977d 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -148,12 +148,14 @@ void ColorConsoleBackend::Write(const Entry& entry) {
PrintColoredMessage(entry);
}
-FileBackend::FileBackend(const std::string& filename) : bytes_written(0) {
- if (FS::Exists(filename + ".old.txt")) {
- FS::Delete(filename + ".old.txt");
+FileBackend::FileBackend(const std::string& filename) {
+ const auto old_filename = filename + ".old.txt";
+
+ if (FS::Exists(old_filename)) {
+ FS::Delete(old_filename);
}
if (FS::Exists(filename)) {
- FS::Rename(filename, filename + ".old.txt");
+ FS::Rename(filename, old_filename);
}
// _SH_DENYWR allows read only access to the file for other programs.
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index 84a544ea4..9dd2589c3 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -94,8 +94,8 @@ public:
void Write(const Entry& entry) override;
private:
- Common::FS::IOFile file;
- std::size_t bytes_written;
+ FS::IOFile file;
+ std::size_t bytes_written = 0;
};
/**