common/log: Move Log namespace into the Common namespace
Forgot to move this over when I moved the rest of the source files with lacking namespaces over.
This commit is contained in:
parent
4fd0cbebdb
commit
b4c38372d1
18 changed files with 66 additions and 54 deletions
|
@ -22,7 +22,7 @@
|
|||
#include "common/string_util.h"
|
||||
#include "common/threadsafe_queue.h"
|
||||
|
||||
namespace Log {
|
||||
namespace Common::Log {
|
||||
|
||||
Filter filter;
|
||||
void SetGlobalFilter(const Filter& f) {
|
||||
|
@ -302,4 +302,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
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "common/logging/filter.h"
|
||||
#include "common/logging/log.h"
|
||||
|
||||
namespace Log {
|
||||
namespace Common::Log {
|
||||
|
||||
/**
|
||||
* A log entry. Log entries are store in a structured format to permit more varied output
|
||||
|
@ -143,4 +143,4 @@ const char* GetLogClassName(Class log_class);
|
|||
*/
|
||||
const char* GetLevelName(Level log_level);
|
||||
|
||||
} // namespace Log
|
||||
} // namespace Common::Log
|
||||
|
|
|
@ -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) {
|
||||
|
@ -96,4 +96,4 @@ bool Filter::CheckMessage(Class log_class, Level level) const {
|
|||
return static_cast<u8>(level) >=
|
||||
static_cast<u8>(class_levels[static_cast<std::size_t>(log_class)]);
|
||||
}
|
||||
} // namespace Log
|
||||
} // namespace Common::Log
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
#include <string_view>
|
||||
#include "common/logging/log.h"
|
||||
|
||||
namespace Log {} // namespace Log
|
||||
namespace Common::Log {} // namespace Common::Log
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "common/common_types.h"
|
||||
#include "common/logging/formatter.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) {
|
||||
|
@ -173,33 +173,39 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig
|
|||
fmt::make_format_args(args...));
|
||||
}
|
||||
|
||||
} // namespace Log
|
||||
} // namespace Common::Log
|
||||
|
||||
// Define the fmt lib macros
|
||||
#define LOG_GENERIC(log_class, log_level, ...) \
|
||||
::Log::FmtLogMessage(log_class, log_level, ::Log::TrimSourcePath(__FILE__), __LINE__, \
|
||||
__func__, __VA_ARGS__)
|
||||
Common::Log::FmtLogMessage(log_class, log_level, Common::Log::TrimSourcePath(__FILE__), \
|
||||
__LINE__, __func__, __VA_ARGS__)
|
||||
|
||||
#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__)
|
||||
|
|
|
@ -18,7 +18,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);
|
||||
|
@ -141,4 +141,4 @@ void PrintMessageToLogcat([[maybe_unused]] const Entry& entry) {
|
|||
__android_log_print(android_log_priority, "CitraNative", "%s", str.c_str());
|
||||
#endif
|
||||
}
|
||||
} // namespace Log
|
||||
} // namespace Common::Log
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
namespace Log {
|
||||
namespace Common::Log {
|
||||
|
||||
struct Entry;
|
||||
|
||||
|
@ -19,4 +19,4 @@ void PrintMessage(const Entry& entry);
|
|||
void PrintColoredMessage(const Entry& entry);
|
||||
/// Formats and prints a log entry to the android logcat.
|
||||
void PrintMessageToLogcat(const Entry& entry);
|
||||
} // namespace Log
|
||||
} // namespace Common::Log
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue