Merge pull request #6555 from jbroadus/logging-cleanup-1

Fix nomenclature in logging functions.
This commit is contained in:
John Maguire 2020-01-30 17:29:22 +00:00 committed by GitHub
commit aae7b01ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 14 deletions

View File

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

View File

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