summaryrefslogtreecommitdiff
path: root/src/common/logging/backend.h
diff options
context:
space:
mode:
authorGravatar Morph2021-06-13 07:52:02 -0400
committerGravatar Morph2021-06-13 11:05:58 -0400
commit8150c65c07c39ab842f8c3249464ece1af4db9b4 (patch)
tree8526f7bac5febb719665c3be957d93be6784f9ed /src/common/logging/backend.h
parentMerge pull request #6452 from german77/sixaxis_firmware_stub (diff)
downloadyuzu-8150c65c07c39ab842f8c3249464ece1af4db9b4.tar.gz
yuzu-8150c65c07c39ab842f8c3249464ece1af4db9b4.tar.xz
yuzu-8150c65c07c39ab842f8c3249464ece1af4db9b4.zip
common: logging: backend: Wrap IOFile in a unique_ptr
Allows us to forward declare Common::FS::IOFile.
Diffstat (limited to 'src/common/logging/backend.h')
-rw-r--r--src/common/logging/backend.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index eb629a33f..826bde694 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -8,10 +8,13 @@
8#include <memory> 8#include <memory>
9#include <string> 9#include <string>
10#include <string_view> 10#include <string_view>
11#include "common/fs/file.h"
12#include "common/logging/filter.h" 11#include "common/logging/filter.h"
13#include "common/logging/log.h" 12#include "common/logging/log.h"
14 13
14namespace Common::FS {
15class IOFile;
16}
17
15namespace Common::Log { 18namespace Common::Log {
16 19
17class Filter; 20class Filter;
@@ -38,6 +41,7 @@ struct Entry {
38class Backend { 41class Backend {
39public: 42public:
40 virtual ~Backend() = default; 43 virtual ~Backend() = default;
44
41 virtual void SetFilter(const Filter& new_filter) { 45 virtual void SetFilter(const Filter& new_filter) {
42 filter = new_filter; 46 filter = new_filter;
43 } 47 }
@@ -53,6 +57,8 @@ private:
53 */ 57 */
54class ConsoleBackend : public Backend { 58class ConsoleBackend : public Backend {
55public: 59public:
60 ~ConsoleBackend() override;
61
56 static const char* Name() { 62 static const char* Name() {
57 return "console"; 63 return "console";
58 } 64 }
@@ -67,6 +73,8 @@ public:
67 */ 73 */
68class ColorConsoleBackend : public Backend { 74class ColorConsoleBackend : public Backend {
69public: 75public:
76 ~ColorConsoleBackend() override;
77
70 static const char* Name() { 78 static const char* Name() {
71 return "color_console"; 79 return "color_console";
72 } 80 }
@@ -83,6 +91,7 @@ public:
83class FileBackend : public Backend { 91class FileBackend : public Backend {
84public: 92public:
85 explicit FileBackend(const std::filesystem::path& filename); 93 explicit FileBackend(const std::filesystem::path& filename);
94 ~FileBackend() override;
86 95
87 static const char* Name() { 96 static const char* Name() {
88 return "file"; 97 return "file";
@@ -95,7 +104,7 @@ public:
95 void Write(const Entry& entry) override; 104 void Write(const Entry& entry) override;
96 105
97private: 106private:
98 FS::IOFile file; 107 std::unique_ptr<FS::IOFile> file;
99 std::size_t bytes_written = 0; 108 std::size_t bytes_written = 0;
100}; 109};
101 110
@@ -104,6 +113,8 @@ private:
104 */ 113 */
105class DebuggerBackend : public Backend { 114class DebuggerBackend : public Backend {
106public: 115public:
116 ~DebuggerBackend() override;
117
107 static const char* Name() { 118 static const char* Name() {
108 return "debugger"; 119 return "debugger";
109 } 120 }