diff options
Diffstat (limited to 'src/common/logging/backend.cpp')
| -rw-r--r-- | src/common/logging/backend.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 4575df24d..c06364977 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include "common/threadsafe_queue.h" | 25 | #include "common/threadsafe_queue.h" |
| 26 | #include "core/settings.h" | 26 | #include "core/settings.h" |
| 27 | 27 | ||
| 28 | namespace Log { | 28 | namespace Common::Log { |
| 29 | 29 | ||
| 30 | /** | 30 | /** |
| 31 | * Static state as a singleton. | 31 | * Static state as a singleton. |
| @@ -132,7 +132,7 @@ private: | |||
| 132 | std::mutex writing_mutex; | 132 | std::mutex writing_mutex; |
| 133 | std::thread backend_thread; | 133 | std::thread backend_thread; |
| 134 | std::vector<std::unique_ptr<Backend>> backends; | 134 | std::vector<std::unique_ptr<Backend>> backends; |
| 135 | Common::MPSCQueue<Log::Entry> message_queue; | 135 | MPSCQueue<Entry> message_queue; |
| 136 | Filter filter; | 136 | Filter filter; |
| 137 | std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()}; | 137 | std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()}; |
| 138 | }; | 138 | }; |
| @@ -146,16 +146,16 @@ void ColorConsoleBackend::Write(const Entry& entry) { | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | FileBackend::FileBackend(const std::string& filename) : bytes_written(0) { | 148 | FileBackend::FileBackend(const std::string& filename) : bytes_written(0) { |
| 149 | if (Common::FS::Exists(filename + ".old.txt")) { | 149 | if (FS::Exists(filename + ".old.txt")) { |
| 150 | Common::FS::Delete(filename + ".old.txt"); | 150 | FS::Delete(filename + ".old.txt"); |
| 151 | } | 151 | } |
| 152 | if (Common::FS::Exists(filename)) { | 152 | if (FS::Exists(filename)) { |
| 153 | Common::FS::Rename(filename, filename + ".old.txt"); | 153 | FS::Rename(filename, filename + ".old.txt"); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | // _SH_DENYWR allows read only access to the file for other programs. | 156 | // _SH_DENYWR allows read only access to the file for other programs. |
| 157 | // It is #defined to 0 on other platforms | 157 | // It is #defined to 0 on other platforms |
| 158 | file = Common::FS::IOFile(filename, "w", _SH_DENYWR); | 158 | file = FS::IOFile(filename, "w", _SH_DENYWR); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | void FileBackend::Write(const Entry& entry) { | 161 | void FileBackend::Write(const Entry& entry) { |
| @@ -182,7 +182,7 @@ void FileBackend::Write(const Entry& entry) { | |||
| 182 | 182 | ||
| 183 | void DebuggerBackend::Write(const Entry& entry) { | 183 | void DebuggerBackend::Write(const Entry& entry) { |
| 184 | #ifdef _WIN32 | 184 | #ifdef _WIN32 |
| 185 | ::OutputDebugStringW(Common::UTF8ToUTF16W(FormatLogMessage(entry).append(1, '\n')).c_str()); | 185 | ::OutputDebugStringW(UTF8ToUTF16W(FormatLogMessage(entry).append(1, '\n')).c_str()); |
| 186 | #endif | 186 | #endif |
| 187 | } | 187 | } |
| 188 | 188 | ||
| @@ -342,4 +342,4 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, | |||
| 342 | instance.PushEntry(log_class, log_level, filename, line_num, function, | 342 | instance.PushEntry(log_class, log_level, filename, line_num, function, |
| 343 | fmt::vformat(format, args)); | 343 | fmt::vformat(format, args)); |
| 344 | } | 344 | } |
| 345 | } // namespace Log | 345 | } // namespace Common::Log |