Add flag to log source location
This commit is contained in:
parent
3a88377f1d
commit
9099b4ead3
@ -31,12 +31,13 @@ void logToFile(QtMsgType msgType, const QMessageLogContext& msgContext, const QS
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef LOG_SOURCE_LOCATION
|
||||
const auto msgFromFile = QString(msgContext.file);
|
||||
const auto msgFromLine = (msgContext.line == 0) ? QString("") : QString("%1").arg(msgContext.line);
|
||||
|
||||
if(!msgFromFile.isEmpty() && !msgFromLine.isEmpty()) {
|
||||
formattedMsg += QString("[%1:%2] ").arg(msgContext.file).arg(msgContext.line);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOG_FUNCTION_LOCATION
|
||||
const auto msgFromFunction = QString(msgContext.function);
|
||||
|
Loading…
Reference in New Issue
Block a user