QT如何输出调试信息
2017-05-29 00:27
393 查看
复制自源于官方文档:
qCritical(const
char *message,
...)
Calls the message handler with the critical message
message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. On QNX the message is sent to slogger2
It exits if the environment variable QT_FATAL_CRITICALS is not empty.
This function takes a format string and a list of arguments, similar to the C printf() function. The format should be a Latin-1 string.
Example:
If you include <QtDebug>, a more convenient syntax is also available:
A space is inserted between the items, and a newline is appended at the end.
To suppress the output at runtime, install your own message handler with
qInstallMessageHandler().
See also
qDebug(),
qInfo(),
qWarning(),
qFatal(),
qInstallMessageHandler(), and
Debugging Techniques.
qDebug(const
char *message,
...)
Calls the message handler with the debug message
message. If no message handler has been installed, the message is printed to stderr. Under Windows the message is sent to the console, if it is a console application; otherwise, it is sent to the debugger. On QNX, the
message is sent to slogger2. This function does nothing if
QT_NO_DEBUG_OUTPUT was defined during compilation.
If you pass the function a format string and a list of arguments, it works in similar way to the C printf() function. The format should be a Latin-1 string.
Example:
If you include
<QtDebug>, a more convenient syntax is also available:
With this syntax, the function returns a
QDebug object that is configured to use the
QtDebugMsg message type. It automatically puts a single space between each item, and outputs a newline at the end. It supports many C++ and Qt types.
To suppress the output at run-time, install your own message handler with
qInstallMessageHandler().
See also
qInfo(),
qWarning(),
qCritical(),
qFatal(),
qInstallMessageHandler(), and
Debugging Techniques.
qFatal(const
char *message,
...)
Calls the message handler with the fatal message
message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. On QNX the message is sent to slogger2
If you are using the
default message handler this function will abort to create a core dump. On Windows, for debug builds, this function will report a _CRT_ERROR enabling you to connect a debugger to the application.
This function takes a format string and a list of arguments, similar to the C printf() function.
Example:
To suppress the output at runtime, install your own message handler with
qInstallMessageHandler().
See also
qDebug(),
qInfo(),
qWarning(),
qCritical(),
qInstallMessageHandler(), and
Debugging Techniques.
qInfo(const
char *message,
...)
Calls the message handler with the informational message
message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the console, if it is a console application; otherwise, it is sent to the debugger. On QNX the
message is sent to slogger2. This function does nothing if
QT_NO_INFO_OUTPUT was defined during compilation.
If you pass the function a format string and a list of arguments, it works in similar way to the C printf() function. The format should be a Latin-1 string.
Example:
If you include
<QtDebug>, a more convenient syntax is also available:
With this syntax, the function returns a
QDebug object that is configured to use the
QtInfoMsg message type. It automatically puts a single space between each item, and outputs a newline at the end. It supports many C++ and Qt types.
To suppress the output at run-time, install your own message handler with
qInstallMessageHandler().
This function was introduced in Qt 5.5.
See also
qDebug(),
qWarning(),
qCritical(),
qFatal(),
qInstallMessageHandler(), and
Debugging Techniques.
qCritical(const
char *message,
...)
Calls the message handler with the critical message
message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. On QNX the message is sent to slogger2
It exits if the environment variable QT_FATAL_CRITICALS is not empty.
This function takes a format string and a list of arguments, similar to the C printf() function. The format should be a Latin-1 string.
Example:
void load(const QString &fileName)
{
QFile file(fileName);
if (!file.exists())
qCritical("File '%s' does not exist!", qUtf8Printable(fileName));
}
If you include <QtDebug>, a more convenient syntax is also available:
qCritical() << "Brush:" << myQBrush << "Other
value:" << i;
A space is inserted between the items, and a newline is appended at the end.
To suppress the output at runtime, install your own message handler with
qInstallMessageHandler().
See also
qDebug(),
qInfo(),
qWarning(),
qFatal(),
qInstallMessageHandler(), and
Debugging Techniques.
qDebug(const
char *message,
...)
Calls the message handler with the debug message
message. If no message handler has been installed, the message is printed to stderr. Under Windows the message is sent to the console, if it is a console application; otherwise, it is sent to the debugger. On QNX, the
message is sent to slogger2. This function does nothing if
QT_NO_DEBUG_OUTPUT was defined during compilation.
If you pass the function a format string and a list of arguments, it works in similar way to the C printf() function. The format should be a Latin-1 string.
Example:
qDebug("Items in list: %d", myList.size());
If you include
<QtDebug>, a more convenient syntax is also available:
qDebug() << "Brush:" << myQBrush << "Other value:" << i;
With this syntax, the function returns a
QDebug object that is configured to use the
QtDebugMsg message type. It automatically puts a single space between each item, and outputs a newline at the end. It supports many C++ and Qt types.
To suppress the output at run-time, install your own message handler with
qInstallMessageHandler().
See also
qInfo(),
qWarning(),
qCritical(),
qFatal(),
qInstallMessageHandler(), and
Debugging Techniques.
qFatal(const
char *message,
...)
Calls the message handler with the fatal message
message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. On QNX the message is sent to slogger2
If you are using the
default message handler this function will abort to create a core dump. On Windows, for debug builds, this function will report a _CRT_ERROR enabling you to connect a debugger to the application.
This function takes a format string and a list of arguments, similar to the C printf() function.
Example:
int divide(int a, int b)
{
if (b == 0) // program error
qFatal("divide: cannot divide by zero");
return a / b;
}
To suppress the output at runtime, install your own message handler with
qInstallMessageHandler().
See also
qDebug(),
qInfo(),
qWarning(),
qCritical(),
qInstallMessageHandler(), and
Debugging Techniques.
qInfo(const
char *message,
...)
Calls the message handler with the informational message
message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the console, if it is a console application; otherwise, it is sent to the debugger. On QNX the
message is sent to slogger2. This function does nothing if
QT_NO_INFO_OUTPUT was defined during compilation.
If you pass the function a format string and a list of arguments, it works in similar way to the C printf() function. The format should be a Latin-1 string.
Example:
qInfo("Items in list: %d", myList.size());
If you include
<QtDebug>, a more convenient syntax is also available:
qInfo() << "Brush:" << myQBrush << "Other value:" << i;
With this syntax, the function returns a
QDebug object that is configured to use the
QtInfoMsg message type. It automatically puts a single space between each item, and outputs a newline at the end. It supports many C++ and Qt types.
To suppress the output at run-time, install your own message handler with
qInstallMessageHandler().
This function was introduced in Qt 5.5.
See also
qDebug(),
qWarning(),
qCritical(),
qFatal(),
qInstallMessageHandler(), and
Debugging Techniques.
相关文章推荐
- qt中如何用qDebug输出彩色调试信息
- qt中如何用qDebug输出彩色调试信息
- qt中如何用qDebug输出彩色调试信息
- QT for android编写的程序如何输出调试信息到android的log日志
- Window下Qt中用qDebug()输出调试信息到Console控制台的设置方法
- 如何优雅的输出PHP调试信息
- 如何将GDB中需要的调试信息输出到文件
- 如何优雅的输出PHP调试信息
- Java多线程调试如何完成信息输出处理
- C#做单元测试,如何查看输出的调试信息?
- QT中调试信息输出到日志文件
- Win32和MFC项目如何输出调试信息到VS的调试窗口
- QT输出调试信息
- Window下Qt中用qDebug()输出调试信息到Console控制台的设置方法
- QT如何编译出带调试信息的qtwebkit库
- Android调试:如何输出调试信息
- 如何将信息打印到调试输出窗口
- Window下Qt中用qDebug()输出调试信息到Console控制台的设置方法
- QT 自定义调试信息的输出
- 在Delphi中如何输出后台调试信息?