summaryrefslogtreecommitdiffstats
path: root/src/common/logging
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2021-04-15 02:19:52 +0200
committerLioncash <mathew1800@gmail.com>2021-04-15 05:10:58 +0200
commit64606aefcf2407513d3687a1f8d325653bde1f72 (patch)
treee6d171bdaf94d121809cf8f27a00f417bda39f06 /src/common/logging
parentMerge pull request #6192 from lioncash/discard (diff)
downloadyuzu-64606aefcf2407513d3687a1f8d325653bde1f72.tar
yuzu-64606aefcf2407513d3687a1f8d325653bde1f72.tar.gz
yuzu-64606aefcf2407513d3687a1f8d325653bde1f72.tar.bz2
yuzu-64606aefcf2407513d3687a1f8d325653bde1f72.tar.lz
yuzu-64606aefcf2407513d3687a1f8d325653bde1f72.tar.xz
yuzu-64606aefcf2407513d3687a1f8d325653bde1f72.tar.zst
yuzu-64606aefcf2407513d3687a1f8d325653bde1f72.zip
Diffstat (limited to 'src/common/logging')
-rw-r--r--src/common/logging/backend.cpp18
-rw-r--r--src/common/logging/backend.h4
-rw-r--r--src/common/logging/filter.cpp4
-rw-r--r--src/common/logging/filter.h4
-rw-r--r--src/common/logging/log.h34
-rw-r--r--src/common/logging/text_formatter.cpp4
-rw-r--r--src/common/logging/text_formatter.h4
7 files changed, 39 insertions, 33 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 @@
#include "common/threadsafe_queue.h"
#include "core/settings.h"
-namespace Log {
+namespace Common::Log {
/**
* Static state as a singleton.
@@ -132,7 +132,7 @@ private:
std::mutex writing_mutex;
std::thread backend_thread;
std::vector<std::unique_ptr<Backend>> backends;
- Common::MPSCQueue<Log::Entry> message_queue;
+ MPSCQueue<Entry> message_queue;
Filter filter;
std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()};
};
@@ -146,16 +146,16 @@ void ColorConsoleBackend::Write(const Entry& entry) {
}
FileBackend::FileBackend(const std::string& filename) : bytes_written(0) {
- if (Common::FS::Exists(filename + ".old.txt")) {
- Common::FS::Delete(filename + ".old.txt");
+ if (FS::Exists(filename + ".old.txt")) {
+ FS::Delete(filename + ".old.txt");
}
- if (Common::FS::Exists(filename)) {
- Common::FS::Rename(filename, filename + ".old.txt");
+ if (FS::Exists(filename)) {
+ FS::Rename(filename, filename + ".old.txt");
}
// _SH_DENYWR allows read only access to the file for other programs.
// It is #defined to 0 on other platforms
- file = Common::FS::IOFile(filename, "w", _SH_DENYWR);
+ file = FS::IOFile(filename, "w", _SH_DENYWR);
}
void FileBackend::Write(const Entry& entry) {
@@ -182,7 +182,7 @@ void FileBackend::Write(const Entry& entry) {
void DebuggerBackend::Write(const Entry& entry) {
#ifdef _WIN32
- ::OutputDebugStringW(Common::UTF8ToUTF16W(FormatLogMessage(entry).append(1, '\n')).c_str());
+ ::OutputDebugStringW(UTF8ToUTF16W(FormatLogMessage(entry).append(1, '\n')).c_str());
#endif
}
@@ -342,4 +342,4 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
instance.PushEntry(log_class, log_level, filename, line_num, function,
fmt::vformat(format, args));
}
-} // namespace Log
+} // namespace Common::Log
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index da1c2f185..84a544ea4 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -11,7 +11,7 @@
#include "common/logging/filter.h"
#include "common/logging/log.h"
-namespace Log {
+namespace Common::Log {
class Filter;
@@ -135,4 +135,4 @@ const char* GetLevelName(Level log_level);
* never get the message
*/
void SetGlobalFilter(const Filter& filter);
-} // namespace Log \ No newline at end of file
+} // namespace Common::Log \ No newline at end of file
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index 2eccbcd8d..20a2dd106 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -7,7 +7,7 @@
#include "common/logging/filter.h"
#include "common/string_util.h"
-namespace Log {
+namespace Common::Log {
namespace {
template <typename It>
Level GetLevelByName(const It begin, const It end) {
@@ -103,4 +103,4 @@ bool Filter::IsDebug() const {
});
}
-} // namespace Log
+} // namespace Common::Log
diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h
index 773df6f2c..f5673a9f6 100644
--- a/src/common/logging/filter.h
+++ b/src/common/logging/filter.h
@@ -9,7 +9,7 @@
#include <string_view>
#include "common/logging/log.h"
-namespace Log {
+namespace Common::Log {
/**
* Implements a log message filter which allows different log classes to have different minimum
@@ -51,4 +51,4 @@ public:
private:
std::array<Level, static_cast<std::size_t>(Class::Count)> class_levels;
};
-} // namespace Log
+} // namespace Common::Log
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 3d7b7dab7..1f0f8db52 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -7,7 +7,7 @@
#include <fmt/format.h>
#include "common/common_types.h"
-namespace Log {
+namespace Common::Log {
// trims up to and including the last of ../, ..\, src/, src\ in a string
constexpr const char* TrimSourcePath(std::string_view source) {
@@ -148,28 +148,34 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig
fmt::make_format_args(args...));
}
-} // namespace Log
+} // namespace Common::Log
#ifdef _DEBUG
#define LOG_TRACE(log_class, ...) \
- ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Trace, \
- ::Log::TrimSourcePath(__FILE__), __LINE__, __func__, __VA_ARGS__)
+ Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Trace, \
+ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
+ __VA_ARGS__)
#else
#define LOG_TRACE(log_class, fmt, ...) (void(0))
#endif
#define LOG_DEBUG(log_class, ...) \
- ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Debug, \
- ::Log::TrimSourcePath(__FILE__), __LINE__, __func__, __VA_ARGS__)
+ Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Debug, \
+ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
+ __VA_ARGS__)
#define LOG_INFO(log_class, ...) \
- ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Info, \
- ::Log::TrimSourcePath(__FILE__), __LINE__, __func__, __VA_ARGS__)
+ Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Info, \
+ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
+ __VA_ARGS__)
#define LOG_WARNING(log_class, ...) \
- ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Warning, \
- ::Log::TrimSourcePath(__FILE__), __LINE__, __func__, __VA_ARGS__)
+ Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Warning, \
+ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
+ __VA_ARGS__)
#define LOG_ERROR(log_class, ...) \
- ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Error, \
- ::Log::TrimSourcePath(__FILE__), __LINE__, __func__, __VA_ARGS__)
+ Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Error, \
+ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
+ __VA_ARGS__)
#define LOG_CRITICAL(log_class, ...) \
- ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Critical, \
- ::Log::TrimSourcePath(__FILE__), __LINE__, __func__, __VA_ARGS__)
+ Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Critical, \
+ Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
+ __VA_ARGS__)
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index 6a0605c63..80ee2cca1 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -16,7 +16,7 @@
#include "common/logging/text_formatter.h"
#include "common/string_util.h"
-namespace Log {
+namespace Common::Log {
std::string FormatLogMessage(const Entry& entry) {
unsigned int time_seconds = static_cast<unsigned int>(entry.timestamp.count() / 1000000);
@@ -108,4 +108,4 @@ void PrintColoredMessage(const Entry& entry) {
#undef ESC
#endif
}
-} // namespace Log
+} // namespace Common::Log
diff --git a/src/common/logging/text_formatter.h b/src/common/logging/text_formatter.h
index b6d9e57c8..171e74cfe 100644
--- a/src/common/logging/text_formatter.h
+++ b/src/common/logging/text_formatter.h
@@ -7,7 +7,7 @@
#include <cstddef>
#include <string>
-namespace Log {
+namespace Common::Log {
struct Entry;
@@ -17,4 +17,4 @@ std::string FormatLogMessage(const Entry& entry);
void PrintMessage(const Entry& entry);
/// Prints the same message as `PrintMessage`, but colored according to the severity level.
void PrintColoredMessage(const Entry& entry);
-} // namespace Log
+} // namespace Common::Log