mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-24 16:31:22 +01:00
Move unneeded declarations and macros from logging header.
Some functions and macros aren't used outside of logging.cpp and don't need be declared in header. Functions can be static.
This commit is contained in:
parent
90cf4988ea
commit
79ac16afeb
@ -51,6 +51,9 @@ static const char* kMessageHandlerMagic = "__logging_message__";
|
||||
static const int kMessageHandlerMagicLength = strlen(kMessageHandlerMagic);
|
||||
static QtMessageHandler sOriginalMessageHandler = nullptr;
|
||||
|
||||
static QDebug CreateLogger(Level level, const QString& class_name, int line,
|
||||
const char* category);
|
||||
|
||||
void GLog(const char* domain, int level, const char* message, void* user_data) {
|
||||
switch (level) {
|
||||
case G_LOG_FLAG_RECURSION:
|
||||
@ -147,7 +150,7 @@ void SetLevels(const QString& levels) {
|
||||
}
|
||||
}
|
||||
|
||||
QString ParsePrettyFunction(const char* pretty_function) {
|
||||
static QString ParsePrettyFunction(const char* pretty_function) {
|
||||
// Get the class name out of the function name.
|
||||
QString class_name = pretty_function;
|
||||
const int paren = class_name.indexOf('(');
|
||||
@ -168,8 +171,8 @@ QString ParsePrettyFunction(const char* pretty_function) {
|
||||
return class_name;
|
||||
}
|
||||
|
||||
QDebug CreateLogger(Level level, const QString& class_name, int line,
|
||||
const char* category) {
|
||||
static QDebug CreateLogger(Level level, const QString& class_name, int line,
|
||||
const char* category) {
|
||||
// Map the level to a string
|
||||
const char* level_name = nullptr;
|
||||
switch (level) {
|
||||
@ -280,6 +283,11 @@ void DumpStackTrace() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#define qCreateLogger(line, pretty_function, category, level) \
|
||||
logging::CreateLogger(logging::Level_##level, \
|
||||
logging::ParsePrettyFunction(pretty_function), line, \
|
||||
category)
|
||||
|
||||
QDebug CreateLoggerFatal(int line, const char* pretty_function,
|
||||
const char* category) {
|
||||
return qCreateLogger(line, pretty_function, category, Fatal);
|
||||
|
@ -44,11 +44,6 @@
|
||||
#define qLogCat(level, category) \
|
||||
logging::CreateLogger##level(__LINE__, __PRETTY_FUNCTION__, category)
|
||||
|
||||
#define qCreateLogger(line, pretty_function, category, level) \
|
||||
logging::CreateLogger(logging::Level_##level, \
|
||||
logging::ParsePrettyFunction(pretty_function), line, \
|
||||
category)
|
||||
|
||||
#endif // QT_NO_DEBUG_STREAM
|
||||
|
||||
namespace logging {
|
||||
@ -71,10 +66,6 @@ void SetLevels(const QString& levels);
|
||||
|
||||
void DumpStackTrace();
|
||||
|
||||
QString ParsePrettyFunction(const char* pretty_function);
|
||||
QDebug CreateLogger(Level level, const QString& class_name, int line,
|
||||
const char* category);
|
||||
|
||||
QDebug CreateLoggerFatal(int line, const char* pretty_function,
|
||||
const char* category);
|
||||
QDebug CreateLoggerError(int line, const char* pretty_function,
|
||||
|
Loading…
Reference in New Issue
Block a user