Log: add debug info to log in release build

This commit is contained in:
Le Tan 2018-08-13 20:14:03 +08:00
parent 5b7c4943e3
commit be5e34cc85
3 changed files with 10 additions and 6 deletions

View File

@ -75,19 +75,18 @@ void VLogger(QtMsgType type, const QMessageLogContext &context, const QString &m
break;
}
QString fileName = QFileInfo(context.file).fileName();
#if defined(QT_NO_DEBUG)
Q_UNUSED(context);
QTextStream stream(&g_logFile);
stream << header << localMsg << "\n";
stream << header << (QString("(%1:%2) ").arg(fileName).arg(context.line))
<< localMsg << "\n";
if (type == QtFatalMsg) {
g_logFile.close();
abort();
}
#else
std::string fileStr = QFileInfo(context.file).fileName().toStdString();
std::string fileStr = fileName.toStdString();
const char *file = fileStr.c_str();
switch (type) {
@ -168,6 +167,8 @@ int main(int argc, char *argv[])
qInstallMessageHandler(VLogger);
qInfo() << "VNote started" << g_config->c_version << QDateTime::currentDateTime().toString();
QString locale = VUtils::getLocale();
// Set default locale.
if (locale == "zh_CN") {

View File

@ -301,7 +301,7 @@ listview_item_selected_inactive_fg=@inactive_fg
listview_item_selected_inactive_bg=@inactive_bg
; QAbstractItemView for TextEdit Completer.
abstractitemview_textedit_fg=#content_fg
abstractitemview_textedit_fg=@content_fg
abstractitemview_textedit_bg=#DADADA
abstractitemview_textedit_item_hover_fg=@abstractitemview_textedit_fg
abstractitemview_textedit_item_hover_bg=@master_hover_bg

View File

@ -8,6 +8,9 @@ QT += core gui webenginewidgets webchannel network svg printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
# Enable message log in release build
DEFINES += QT_MESSAGELOGCONTEXT
TARGET = VNote
TEMPLATE = app