libcalamares: improve formatting of Qt error messages
These come through without function information, but we can format them in one line by mis-using function info.
This commit is contained in:
parent
b57db97412
commit
d2c3f7a326
@ -98,18 +98,19 @@ log_implementation( const char* msg, unsigned int debugLevel, const char* funcin
|
||||
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << "]: " << funcinfo
|
||||
<< '\n';
|
||||
}
|
||||
if (msg) {
|
||||
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << (funcinfo ? "]: " : "]: ") << msg << '\n';
|
||||
|
||||
}
|
||||
logfile.flush();
|
||||
|
||||
if ( logLevelEnabled( debugLevel ) )
|
||||
{
|
||||
if ( funcinfo )
|
||||
{
|
||||
std::cout << time.toUtf8().data() << " [" << debugLevel << "]: " << funcinfo << s_Continuation;
|
||||
std::cout << time.toUtf8().data() << " [" << debugLevel << "]: " << funcinfo << (msg ? s_Continuation : "");
|
||||
}
|
||||
// The endl is desired, since it also flushes (like the logfile, above)
|
||||
std::cout << msg << std::endl;
|
||||
std::cout << (msg ? msg : "") << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,20 +118,25 @@ static void
|
||||
CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& msg )
|
||||
{
|
||||
unsigned int level = LOGVERBOSE;
|
||||
const char * funcinfo = nullptr;
|
||||
switch ( type )
|
||||
{
|
||||
case QtInfoMsg:
|
||||
level = LOGVERBOSE;
|
||||
funcinfo = "INFO";
|
||||
break;
|
||||
case QtDebugMsg:
|
||||
level = LOGDEBUG;
|
||||
funcinfo = "DEBUG";
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
level = LOGWARNING;
|
||||
funcinfo = "WARNING";
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
case QtFatalMsg:
|
||||
level = LOGERROR;
|
||||
funcinfo = "ERROR";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -139,7 +145,7 @@ CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& m
|
||||
return;
|
||||
}
|
||||
|
||||
log_implementation( msg.toUtf8().constData(), level, nullptr );
|
||||
log_implementation( nullptr, level, (QString(funcinfo) + QStringLiteral(" (Qt): ") + msg).toUtf8().constData() );
|
||||
}
|
||||
|
||||
QString
|
||||
|
Loading…
Reference in New Issue
Block a user