Make logging of source function optional
This commit is contained in:
parent
4a2590ff0e
commit
c86ec41b75
@ -33,14 +33,17 @@ void logToFile(QtMsgType msgType, const QMessageLogContext& msgContext, const QS
|
|||||||
|
|
||||||
const auto msgFromFile = QString(msgContext.file);
|
const auto msgFromFile = QString(msgContext.file);
|
||||||
const auto msgFromLine = (msgContext.line == 0) ? QString("") : QString("%1").arg(msgContext.line);
|
const auto msgFromLine = (msgContext.line == 0) ? QString("") : QString("%1").arg(msgContext.line);
|
||||||
const auto msgFromFunction = QString(msgContext.function);
|
|
||||||
|
|
||||||
if(!msgFromFile.isEmpty() && !msgFromLine.isEmpty()) {
|
if(!msgFromFile.isEmpty() && !msgFromLine.isEmpty()) {
|
||||||
formattedMsg += QString("[%1:%2] ").arg(msgContext.file).arg(msgContext.line);
|
formattedMsg += QString("[%1:%2] ").arg(msgContext.file).arg(msgContext.line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LOG_FUNCTION_LOCATION
|
||||||
|
const auto msgFromFunction = QString(msgContext.function);
|
||||||
if(!msgFromFunction.isEmpty()) {
|
if(!msgFromFunction.isEmpty()) {
|
||||||
formattedMsg += QString("[%1] ").arg(msgContext.function);
|
formattedMsg += QString("[%1] ").arg(msgContext.function);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
formattedMsg += QString("%1").arg(msg);
|
formattedMsg += QString("%1").arg(msg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user