Give log channels fancier names

Improve LOG_CHANNEL macro to accept custom name.
This commit is contained in:
Nekotekina
2020-02-01 10:43:43 +03:00
parent ec80932c21
commit 3c0bd821c8
33 changed files with 46 additions and 34 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
#include <typeinfo>
#include <charconv>
LOG_CHANNEL(cfg_log);
LOG_CHANNEL(cfg_log, "CFG");
namespace cfg
{
+1 -1
View File
@@ -14,7 +14,7 @@
#define CAN_OVERCOMMIT
#endif
LOG_CHANNEL(jit_log);
LOG_CHANNEL(jit_log, "JIT");
static u8* get_jit_memory()
{
+13 -1
View File
@@ -101,9 +101,21 @@ namespace logs
// Get all registered log channels
std::vector<std::string> get_channels();
// Helper: no additional name specified
constexpr const char* make_channel_name(const char* name)
{
return name;
}
// Helper: special channel name specified
constexpr const char* make_channel_name(const char*, const char* name, ...)
{
return name;
}
}
#define LOG_CHANNEL(ch) inline ::logs::channel ch(#ch)
#define LOG_CHANNEL(ch, ...) inline ::logs::channel ch(::logs::make_channel_name(#ch, ##__VA_ARGS__))
// Legacy:
+1 -1
View File
@@ -46,7 +46,7 @@
#include "Log.h"
LOG_CHANNEL(sig_log);
LOG_CHANNEL(vm_log);
LOG_CHANNEL(vm_log, "VM");
thread_local u64 g_tls_fault_all = 0;
thread_local u64 g_tls_fault_rsx = 0;