Fix nomenclature in logging functions.

The qLog macro passes the result of the __PRETTY_FUNCTION__ macro to the
CreateLogger* functions, but these all take an argument called class_name.
This commit is contained in:
Jim Broadus 2020-01-29 19:56:54 -08:00
parent 0598b81c42
commit 203d6425fd
2 changed files with 23 additions and 14 deletions

View File

@ -271,21 +271,31 @@ void DumpStackTrace() {
#endif
}
QDebug CreateLoggerFatal(int line, const char *class_name) { return qCreateLogger(line, class_name, Fatal); }
QDebug CreateLoggerError(int line, const char *class_name) { return qCreateLogger(line, class_name, Error); }
QDebug CreateLoggerFatal(int line, const char* pretty_function) {
return qCreateLogger(line, pretty_function, Fatal);
}
QDebug CreateLoggerError(int line, const char* pretty_function) {
return qCreateLogger(line, pretty_function, Error);
}
#ifdef QT_NO_WARNING_OUTPUT
QNoDebug CreateLoggerWarning(int, const char*) { return QNoDebug(); }
#else
QDebug CreateLoggerWarning(int line, const char *class_name) { return qCreateLogger(line, class_name, Warning); }
QDebug CreateLoggerWarning(int line, const char* pretty_function) {
return qCreateLogger(line, pretty_function, Warning);
}
#endif // QT_NO_WARNING_OUTPUT
#ifdef QT_NO_DEBUG_OUTPUT
QNoDebug CreateLoggerInfo(int, const char*) { return QNoDebug(); }
QNoDebug CreateLoggerDebug(int, const char*) { return QNoDebug(); }
#else
QDebug CreateLoggerInfo(int line, const char *class_name) { return qCreateLogger(line, class_name, Info); }
QDebug CreateLoggerDebug(int line, const char *class_name) { return qCreateLogger(line, class_name, Debug); }
QDebug CreateLoggerInfo(int line, const char* pretty_function) {
return qCreateLogger(line, pretty_function, Info);
}
QDebug CreateLoggerDebug(int line, const char* pretty_function) {
return qCreateLogger(line, pretty_function, Debug);
}
#endif // QT_NO_DEBUG_OUTPUT
} // namespace logging

View File

@ -34,10 +34,9 @@
#define qLog(level) \
logging::CreateLogger##level(__LINE__, __PRETTY_FUNCTION__)
#define qCreateLogger(line, class_name, level) \
logging::CreateLogger(logging::Level_##level, \
logging::ParsePrettyFunction(class_name), \
line)
#define qCreateLogger(line, pretty_function, level) \
logging::CreateLogger(logging::Level_##level, \
logging::ParsePrettyFunction(pretty_function), line)
#endif // QT_NO_DEBUG_STREAM
@ -64,21 +63,21 @@ void DumpStackTrace();
QString ParsePrettyFunction(const char* pretty_function);
QDebug CreateLogger(Level level, const QString& class_name, int line);
QDebug CreateLoggerFatal(int line, const char* class_name);
QDebug CreateLoggerError(int line, const char* class_name);
QDebug CreateLoggerFatal(int line, const char* pretty_function);
QDebug CreateLoggerError(int line, const char* pretty_function);
#ifdef QT_NO_WARNING_OUTPUT
QNoDebug CreateLoggerWarning(int, const char*);
#else
QDebug CreateLoggerWarning(int line, const char* class_name);
QDebug CreateLoggerWarning(int line, const char* pretty_function);
#endif // QT_NO_WARNING_OUTPUT
#ifdef QT_NO_DEBUG_OUTPUT
QNoDebug CreateLoggerInfo(int, const char*);
QNoDebug CreateLoggerDebug(int, const char*);
#else
QDebug CreateLoggerInfo(int line, const char* class_name);
QDebug CreateLoggerDebug(int line, const char* class_name);
QDebug CreateLoggerInfo(int line, const char* pretty_function);
QDebug CreateLoggerDebug(int line, const char* pretty_function);
#endif // QT_NO_DEBUG_OUTPUT