![]() |
Qt 6.x
The Qt SDK
|
#include "qglobal_p.h"
#include "qlogging.h"
#include "qlogging_p.h"
#include "qlist.h"
#include "qbytearray.h"
#include "qscopeguard.h"
#include "qstring.h"
#include "qvarlengtharray.h"
#include "qdebug.h"
#include "qmutex.h"
#include <QtCore/private/qlocking_p.h>
#include <QtCore/private/qsimd_p.h>
#include "qloggingcategory.h"
#include "qelapsedtimer.h"
#include "qdeadlinetimer.h"
#include "qdatetime.h"
#include "qcoreapplication.h"
#include "qthread.h"
#include "private/qloggingregistry_p.h"
#include "private/qcoreapplication_p.h"
#include <qtcore_tracepoints_p.h>
#include <cstdlib>
#include <algorithm>
#include <memory>
#include <vector>
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | QMessagePattern |
Namespaces | |
namespace | QtPrivate |
\macro QT_NAMESPACE | |
Macros | |
#define | IF_TOKEN(LEVEL) |
#define | HANDLE_IF_TOKEN(LEVEL) |
Variables | |
static const char | categoryTokenC [] = "%{category}" |
static const char | typeTokenC [] = "%{type}" |
static const char | messageTokenC [] = "%{message}" |
static const char | fileTokenC [] = "%{file}" |
static const char | lineTokenC [] = "%{line}" |
static const char | functionTokenC [] = "%{function}" |
static const char | pidTokenC [] = "%{pid}" |
static const char | appnameTokenC [] = "%{appname}" |
static const char | threadidTokenC [] = "%{threadid}" |
static const char | qthreadptrTokenC [] = "%{qthreadptr}" |
static const char | timeTokenC [] = "%{time" |
static const char | backtraceTokenC [] = "%{backtrace" |
static const char | ifCategoryTokenC [] = "%{if-category}" |
static const char | ifDebugTokenC [] = "%{if-debug}" |
static const char | ifInfoTokenC [] = "%{if-info}" |
static const char | ifWarningTokenC [] = "%{if-warning}" |
static const char | ifCriticalTokenC [] = "%{if-critical}" |
static const char | ifFatalTokenC [] = "%{if-fatal}" |
static const char | endifTokenC [] = "%{endif}" |
static const char | emptyTokenC [] = "" |
static const char | defaultPattern [] = "%{if-category}%{category}: %{endif}%{message}" |
static Q_CONSTINIT QBasicAtomicPointer< void(QtMsgType, const QMessageLogContext &, const QString &)> | messageHandler = Q_BASIC_ATOMIC_INITIALIZER(nullptr) |
#define HANDLE_IF_TOKEN | ( | LEVEL | ) |
#define IF_TOKEN | ( | LEVEL | ) |
|
static |
Definition at line 173 of file qlogging.cpp.
References QString::isEmpty(), ok, qgetenv(), str, and QString::toInt().
Referenced by isFatal().
|
static |
Definition at line 1994 of file qlogging.cpp.
Referenced by qt_message_print().
|
static |
Definition at line 187 of file qlogging.cpp.
References qYieldCpu().
Referenced by isFatal().
|
static |
Definition at line 216 of file qlogging.cpp.
References category().
Referenced by qt_message_print().
|
static |
Definition at line 198 of file qlogging.cpp.
References checked_var_value(), is_fatal_count_down(), QtCriticalMsg, QtFatalMsg, and QtWarningMsg.
Referenced by QMessageLogger::critical(), QMessageLogger::critical(), QMessageLogger::debug(), QMessageLogger::debug(), MFPlayerSession::error(), MFPlayerControl::handleError(), QMessageLogger::info(), qt_message_output(), QMessageLogger::warning(), and QMessageLogger::warning().
Q_TRACE_POINT | ( | qtcore | , |
qt_message_print | , | ||
int | type, | ||
const char * | category, | ||
const char * | function, | ||
const char * | file, | ||
int | line, | ||
const QString & | message | ||
) |
Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo | ( | QByteArray | info | ) |
Definition at line 990 of file qlogging.cpp.
References forever, info, pos, and QFileInfo::size().
|
static |
Definition at line 1942 of file qlogging.cpp.
References context, AppleUnifiedLogger::messageHandler(), and stderr_message_handler().
Referenced by qInstallMessageHandler(), and qt_message_print().
void qErrnoWarning | ( | const char * | msg, |
... | |||
) |
Definition at line 2073 of file qlogging.cpp.
References context, qt_error_string(), qt_message_output(), QtCriticalMsg, and QString::vasprintf().
Referenced by QBsdKeyboardHandler::QBsdKeyboardHandler(), QBsdMouseHandler::QBsdMouseHandler(), QEvdevTabletHandler::QEvdevTabletHandler(), QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(), QFbVtHandler::QFbVtHandler(), QTsLibMouseHandler::QTsLibMouseHandler(), QtWaylandClient::QWaylandDisplay::QWaylandDisplay(), QtWaylandClient::QWaylandShmBuffer::QWaylandShmBuffer(), QWindowsFontEngine::QWindowsFontEngine(), QWindowsGLContext::QWindowsGLContext(), QWindowsMessageWindowClassContext::QWindowsMessageWindowClassContext(), QWindowsPipeReader::QWindowsPipeReader(), QWindowsPipeWriter::QWindowsPipeWriter(), QWinEventNotifierPrivate::QWinEventNotifierPrivate(), QWindowsFontEngine::~QWindowsFontEngine(), QWinSettingsPrivate::~QWinSettingsPrivate(), QWindowsFontEngineDirectWrite::addGlyphsToPath(), QWindowsRemovableDriveListener::addPath(), QInotifyFileSystemWatcherEngine::addPaths(), QWin32PrintEngine::begin(), QWindowsFontEngineDirectWrite::boundingBox(), QWindowsVistaStylePrivate::buffer(), QQC2::QWindowsXPStylePrivate::buffer(), byteArrayFromBuffer(), checkXdgRuntimeDir(), childKeysOrGroups(), QEglFSKmsEglDevice::close(), QWin32PrintEnginePrivate::composeGdiPath(), QEvdevMouseHandler::create(), QEvdevKeyboardHandler::create(), WindowCreationData::create(), QWindowsNativeFileDialogEventHandler::create(), ARB::createContext(), GDI::createContext(), createDummyGLContext(), QWindowsFontDatabase::createEngine(), QKmsDevice::createScreens(), QWindowsVistaStylePrivate::createTheme(), QQC2::QWindowsXPStylePrivate::createTheme(), deleteChildGroups(), QWin32PrintEngine::drawPixmap(), QWin32PrintEngine::drawTiledPixmap(), enableNonClientDpiScaling(), QWin32PrintEngine::end(), QEglFSKmsGbmScreen::ensureModeSet(), QBluetoothSocketPrivateWinRT::ensureNativeSocket(), QEglFSKmsGbmScreen::flip(), QWindowsBackingStore::flush(), QWindowsGeometryHint::frame(), QWindowsGeometryHint::frameOnPrimaryScreen(), getDiBits(), QWindowsFontEngineDirectWrite::getSfntTableData(), QWindowsFontEngineDirectWrite::getUnscaledGlyph(), QWindowsFontEngineDirectWrite::glyphIndex(), QFileSystemEngine::id(), imageFromWinHBITMAP_GetDiBits(), QWindowsOpengl32DLL::init(), QWindowsNativeFileDialogBase::init(), QIntegrityFbScreen::initialize(), QWin32PrintEnginePrivate::initialize(), QBsdFbScreen::initialize(), QLinuxFbScreen::initialize(), launchMail(), QWindowsGLContext::makeCurrent(), QWin32PrintEngine::newPage(), QGeoPositionInfoSourceWinRT::onPositionChanged(), SocketWorker::onReadyRead(), QEglFSKmsGbmDevice::open(), QEglFSKmsVsp2Device::open(), QLinuxFbDevice::open(), QEglFSMaliIntegration::platformInit(), QWindowsDirect2DWindow::present(), QEventDispatcherUNIX::processEvents(), ARB::qSurfaceFormatFromHDC(), qt_create_internal_window(), qt_imageToWinHBITMAP(), qt_report_error(), qt_report_pthread_error(), QEvdevTabletHandler::readData(), QEvdevTouchScreenHandler::readData(), QEvdevKeyboardHandler::readKeycode(), QEvdevMouseHandler::readMouseData(), QWindowsFontEngineDirectWrite::recalcAdvances(), QWindowsMimeRegistry::registerMimeType(), QEventDispatcherWin32Private::registerTimer(), QWindowsWindow::registerTouchWindow(), QWindowsClipboard::registerViewer(), QWindowsContext::registerWindowClass(), QWinSettingsPrivate::remove(), QWin32PrintEnginePrivate::resetDC(), QWindowsFileSystemWatcherEngineThread::run(), QWinSettingsPrivate::set(), QLinuxMediaDevice::OutputSubDevice::setFormat(), QLinuxMediaDevice::CaptureSubDevice::setFormat(), QWindowsClipboard::setMimeData(), QLinuxFbDevice::setMode(), QWindowsNativeFileDialogBase::setMode(), QLinuxMediaDevice::setSubdevAlpha(), QGeoPositionInfoSourceWinRT::setUpdateInterval(), QWindowsNativeFileDialogBase::shellItem(), QWindowsPipeWriter::stop(), QWindowsFontEngineDirectWrite::stringToCMap(), QLinuxFbDevice::swapBuffers(), QEglFSKmsEglDeviceScreen::waitForFlip(), and QEventDispatcherWin32::wakeUp().
void qErrnoWarning | ( | int | code, |
const char * | msg, | ||
... | |||
) |
Definition at line 2089 of file qlogging.cpp.
References context, qt_error_string(), qt_message_output(), QtCriticalMsg, and QString::vasprintf().
QtMessageHandler qInstallMessageHandler | ( | QtMessageHandler | h | ) |
Definition at line 2225 of file qlogging.cpp.
References messageHandler, and qDefaultMessageHandler().
Referenced by QDebugMessageServiceImpl::QDebugMessageServiceImpl(), QQmlTestMessageHandler::QQmlTestMessageHandler(), QErrorMessage::~QErrorMessage(), QQmlTestMessageHandler::~QQmlTestMessageHandler(), main(), QTest::messageHandler(), QErrorMessage::qtHandler(), QTestLog::startLogging(), QDebugMessageServiceImpl::stateChanged(), and QTestLog::stopLogging().
Definition at line 2234 of file qlogging.cpp.
References QMessagePattern::mutex.
Referenced by main().
|
static |
Definition at line 371 of file qlogging.cpp.
References context, qt_message_print(), and QString::vasprintf().
Referenced by QMessageLogger::critical(), QMessageLogger::critical(), QMessageLogger::debug(), QMessageLogger::debug(), QMessageLogger::fatal(), QMessageLogger::fatal(), QMessageLogger::info(), QMessageLogger::warning(), and QMessageLogger::warning().
|
static |
\inmodule QtCore \title Qt Logging Types
The <QtLogging> header file defines Qt logging types, functions and macros.
The <QtLogging> header file contains several types, functions and macros for logging.
The QtMsgType enum identifies the various messages that can be generated and sent to a Qt message handler; QtMessageHandler is a type definition for a pointer to a function with the signature {void
myMessageHandler(QtMsgType, const QMessageLogContext &, const char *)}. qInstallMessageHandler() function can be used to install the given QtMessageHandler. QMessageLogContext class contains the line, file, and function the message was logged at. This information is created by the QMessageLogger class.
<QtLogging> also contains functions that generate messages from the given string argument: qDebug(), qInfo(), qWarning(), qCritical(), and qFatal(). These functions call the message handler with the given message.
Example:
Definition at line 2035 of file qlogging.cpp.
References context, Q_UNUSED, qAbort(), and ret.
Referenced by QMessageLogger::critical(), QMessageLogger::critical(), QMessageLogger::debug(), QMessageLogger::debug(), QMessageLogger::fatal(), QMessageLogger::fatal(), QMessageLogger::info(), qt_message_output(), QMessageLogger::warning(), and QMessageLogger::warning().
void qt_message_output | ( | QtMsgType | msgType, |
const QMessageLogContext & | context, | ||
const QString & | message | ||
) |
Definition at line 2066 of file qlogging.cpp.
References context, isFatal(), qt_message_fatal(), and qt_message_print().
Referenced by qErrnoWarning(), and qErrnoWarning().
Definition at line 2023 of file qlogging.cpp.
References QtPrivate::shouldLogToStderr().
|
static |
Definition at line 1998 of file qlogging.cpp.
References context, QLoggingCategory::defaultCategory(), grabMessageHandler(), isDefaultCategory(), messageHandler, Q_TRACE, qDefaultMessageHandler(), qScopeGuard(), qt_message_print(), QtFatalMsg, and ungrabMessageHandler().
Referenced by qt_message(), qt_message_output(), qt_message_print(), and QMessagePattern::setPattern().
|
static |
Definition at line 113 of file qlogging.cpp.
References QThread::currentThreadId(), and QT_PREPEND_NAMESPACE().
Referenced by QT_PREPEND_NAMESPACE().
|
static |
Definition at line 1926 of file qlogging.cpp.
References QByteArray::constData(), context, QString::isNull(), qFormatLogMessage(), and QString::toLocal8Bit().
Referenced by qDefaultMessageHandler().
|
static |
Returns true if writing to stderr
will end up in a console/terminal visible to the user.
This is typically the case if the application was started from the command line.
If the application is started without a controlling console/terminal, but the parent process reads stderr
and presents it to the user in some other way, the parent process may override the detection in this function by setting the QT_ASSUME_STDERR_HAS_CONSOLE environment variable to 1
.
Definition at line 252 of file qlogging.cpp.
References _PATH_TTY, qEnvironmentVariableIntValue(), qt_safe_close(), qt_safe_open(), stderrHasConsoleAttached(), and systemHasStderr().
Referenced by QtPrivate::shouldLogToStderr(), and stderrHasConsoleAttached().
|
static |
Returns true if writing to stderr
is supported.
Definition at line 227 of file qlogging.cpp.
Referenced by stderrHasConsoleAttached().
|
static |
Definition at line 1995 of file qlogging.cpp.
Referenced by qt_message_print().
|
static |
Definition at line 1163 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1167 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1156 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
Definition at line 1177 of file qlogging.cpp.
Referenced by QMessagePattern::QMessagePattern().
|
static |
Definition at line 1175 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1174 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1159 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1161 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1168 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1172 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1169 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1173 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1170 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1171 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1160 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1678 of file qlogging.cpp.
Referenced by QQmlTestMessageHandler::QQmlTestMessageHandler(), qInstallMessageHandler(), and qt_message_print().
|
static |
Definition at line 1158 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1162 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1165 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1164 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1166 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().
|
static |
Definition at line 1157 of file qlogging.cpp.
Referenced by QMessagePattern::setPattern().