mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
Log: add debug info to log in release build
This commit is contained in:
parent
5b7c4943e3
commit
be5e34cc85
11
src/main.cpp
11
src/main.cpp
@ -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") {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user