|
|
|
@ -465,21 +465,27 @@ static void mac_default_handler( const char *msg )
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void qDebug( const char *msg, ... )
|
|
|
|
|
void handle_buffer(const char *buf, QtMsgType msgType)
|
|
|
|
|
{
|
|
|
|
|
char buf[QT_BUFFER_LENGTH];
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii() );
|
|
|
|
|
int len = strlen(buf);
|
|
|
|
|
va_list ap;
|
|
|
|
|
va_start( ap, msg ); // use variable arg list
|
|
|
|
|
#if defined(QT_VSNPRINTF)
|
|
|
|
|
QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH, msg, ap );
|
|
|
|
|
if ( handler ) {
|
|
|
|
|
(*handler)( msgType, buf );
|
|
|
|
|
} else if (msgType == QtFatalMsg) {
|
|
|
|
|
#if defined(Q_CC_MWERKS)
|
|
|
|
|
mac_default_handler(buf);
|
|
|
|
|
#else
|
|
|
|
|
vsprintf( &buf[len], msg, ap );
|
|
|
|
|
fprintf( stderr, "%s\n", buf ); // add newline
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(Q_OS_UNIX) && defined(QT_DEBUG)
|
|
|
|
|
abort(); // trap; generates core dump
|
|
|
|
|
#elif defined(Q_OS_TEMP) && defined(QT_DEBUG)
|
|
|
|
|
QString fstr;
|
|
|
|
|
fstr.sprintf( "%s:%s %s %s\n", __FILE__, __LINE__, QT_VERSION_STR, buf );
|
|
|
|
|
OutputDebugString( fstr.ucs2() );
|
|
|
|
|
#elif defined(_CRT_ERROR) && defined(_DEBUG)
|
|
|
|
|
_CrtDbgReport( _CRT_ERROR, __FILE__, __LINE__, QT_VERSION_STR, buf );
|
|
|
|
|
#else
|
|
|
|
|
exit( 1 ); // goodbye cruel world
|
|
|
|
|
#endif
|
|
|
|
|
va_end( ap );
|
|
|
|
|
if ( handler ) {
|
|
|
|
|
(*handler)( QtDebugMsg, buf );
|
|
|
|
|
} else {
|
|
|
|
|
#if defined(Q_CC_MWERKS)
|
|
|
|
|
mac_default_handler(buf);
|
|
|
|
@ -519,10 +525,24 @@ void debug( const char *msg, ... )
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void qWarning( const char *msg, ... )
|
|
|
|
|
void qDebug( const QString &msg )
|
|
|
|
|
{
|
|
|
|
|
char buf[QT_BUFFER_LENGTH];
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii() );
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").local8Bit() );
|
|
|
|
|
int len = strlen(buf);
|
|
|
|
|
strncpy( &buf[len], msg.local8Bit(), QT_BUFFER_LENGTH - len - 1 );
|
|
|
|
|
len += msg.length();
|
|
|
|
|
if (len >= QT_BUFFER_LENGTH) {
|
|
|
|
|
len = QT_BUFFER_LENGTH - 1;
|
|
|
|
|
}
|
|
|
|
|
buf[len] = '\0';
|
|
|
|
|
handle_buffer(buf, QtDebugMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void qDebug( const char *msg, ... )
|
|
|
|
|
{
|
|
|
|
|
char buf[QT_BUFFER_LENGTH];
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").local8Bit() );
|
|
|
|
|
int len = strlen(buf);
|
|
|
|
|
va_list ap;
|
|
|
|
|
va_start( ap, msg ); // use variable arg list
|
|
|
|
@ -559,24 +579,57 @@ void warning( const char *msg, ... )
|
|
|
|
|
vsprintf( &buf[len], msg, ap );
|
|
|
|
|
#endif
|
|
|
|
|
va_end( ap );
|
|
|
|
|
if ( handler ) {
|
|
|
|
|
(*handler)( QtWarningMsg, buf );
|
|
|
|
|
} else {
|
|
|
|
|
#if defined(Q_CC_MWERKS)
|
|
|
|
|
mac_default_handler(buf);
|
|
|
|
|
#elif defined(Q_OS_TEMP)
|
|
|
|
|
QString fstr( buf );
|
|
|
|
|
OutputDebugString( (fstr + "\n").ucs2() );
|
|
|
|
|
handle_buffer(buf, QtDebugMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void qWarning( const QString &msg )
|
|
|
|
|
{
|
|
|
|
|
char buf[QT_BUFFER_LENGTH];
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").local8Bit() );
|
|
|
|
|
int len = strlen(buf);
|
|
|
|
|
strncpy( &buf[len], msg.local8Bit(), QT_BUFFER_LENGTH - len - 1 );
|
|
|
|
|
len += msg.length();
|
|
|
|
|
if (len >= QT_BUFFER_LENGTH) {
|
|
|
|
|
len = QT_BUFFER_LENGTH - 1;
|
|
|
|
|
}
|
|
|
|
|
buf[len] = '\0';
|
|
|
|
|
handle_buffer(buf, QtWarningMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void qWarning( const char *msg, ... )
|
|
|
|
|
{
|
|
|
|
|
char buf[QT_BUFFER_LENGTH];
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").local8Bit() );
|
|
|
|
|
int len = strlen(buf);
|
|
|
|
|
va_list ap;
|
|
|
|
|
va_start( ap, msg ); // use variable arg list
|
|
|
|
|
#if defined(QT_VSNPRINTF)
|
|
|
|
|
QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH, msg, ap );
|
|
|
|
|
#else
|
|
|
|
|
fprintf( stderr, "%s\n", buf ); // add newline
|
|
|
|
|
vsprintf( &buf[len], msg, ap );
|
|
|
|
|
#endif
|
|
|
|
|
va_end( ap );
|
|
|
|
|
handle_buffer(buf, QtWarningMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void qFatal( const QString &msg )
|
|
|
|
|
{
|
|
|
|
|
char buf[QT_BUFFER_LENGTH];
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").local8Bit() );
|
|
|
|
|
int len = strlen(buf);
|
|
|
|
|
strncpy( &buf[len], msg.local8Bit(), QT_BUFFER_LENGTH - len - 1 );
|
|
|
|
|
len += msg.length();
|
|
|
|
|
if (len >= QT_BUFFER_LENGTH) {
|
|
|
|
|
len = QT_BUFFER_LENGTH - 1;
|
|
|
|
|
}
|
|
|
|
|
buf[len] = '\0';
|
|
|
|
|
handle_buffer(buf, QtFatalMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void qFatal( const char *msg, ... )
|
|
|
|
|
{
|
|
|
|
|
char buf[QT_BUFFER_LENGTH];
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii() );
|
|
|
|
|
strcpy( buf, QDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").local8Bit() );
|
|
|
|
|
int len = strlen(buf);
|
|
|
|
|
va_list ap;
|
|
|
|
|
va_start( ap, msg ); // use variable arg list
|
|
|
|
@ -621,26 +674,7 @@ void fatal( const char *msg, ... )
|
|
|
|
|
vsprintf( &buf[len], msg, ap );
|
|
|
|
|
#endif
|
|
|
|
|
va_end( ap );
|
|
|
|
|
if ( handler ) {
|
|
|
|
|
(*handler)( QtFatalMsg, buf );
|
|
|
|
|
} else {
|
|
|
|
|
#if defined(Q_CC_MWERKS)
|
|
|
|
|
mac_default_handler(buf);
|
|
|
|
|
#else
|
|
|
|
|
fprintf( stderr, "%s\n", buf ); // add newline
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(Q_OS_UNIX) && defined(QT_DEBUG)
|
|
|
|
|
abort(); // trap; generates core dump
|
|
|
|
|
#elif defined(Q_OS_TEMP) && defined(QT_DEBUG)
|
|
|
|
|
QString fstr;
|
|
|
|
|
fstr.sprintf( "%s:%s %s %s\n", __FILE__, __LINE__, QT_VERSION_STR, buf );
|
|
|
|
|
OutputDebugString( fstr.ucs2() );
|
|
|
|
|
#elif defined(_CRT_ERROR) && defined(_DEBUG)
|
|
|
|
|
_CrtDbgReport( _CRT_ERROR, __FILE__, __LINE__, QT_VERSION_STR, buf );
|
|
|
|
|
#else
|
|
|
|
|
exit( 1 ); // goodbye cruel world
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
handle_buffer(buf, QtFatalMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|