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
+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: