mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 11:20:49 +08:00
fix: fixed release build log message
This commit is contained in:
parent
a244f98acc
commit
2eed11e113
@ -1 +1 @@
|
||||
3097
|
||||
3100
|
||||
|
@ -43,22 +43,22 @@ namespace Qv2ray
|
||||
return CommandLineHelpRequested;
|
||||
|
||||
if (parser.isSet(noAPIOption)) {
|
||||
DEBUG(MODULE_INIT, "No API subsystem is set.")
|
||||
DEBUG(MODULE_INIT, "noAPIOption is set.")
|
||||
StartupOption.noAPI = true;
|
||||
}
|
||||
|
||||
if (parser.isSet(runAsRootOption)) {
|
||||
DEBUG(MODULE_INIT, "Force run as root is set.")
|
||||
DEBUG(MODULE_INIT, "runAsRootOption is set.")
|
||||
StartupOption.forceRunAsRootUser = true;
|
||||
}
|
||||
|
||||
if (parser.isSet(debugOption)) {
|
||||
DEBUG(MODULE_INIT, "Debug log is set.")
|
||||
DEBUG(MODULE_INIT, "debugOption is set.")
|
||||
StartupOption.debugLog = true;
|
||||
}
|
||||
|
||||
if (parser.isSet(withToolbarOption)) {
|
||||
DEBUG(MODULE_INIT, "Run with network toolbar is set.")
|
||||
DEBUG(MODULE_INIT, "withToolbarOption is set.")
|
||||
StartupOption.enableToolbarPlguin = true;
|
||||
}
|
||||
|
||||
|
16
src/main.cpp
16
src/main.cpp
@ -31,7 +31,7 @@ bool verifyConfigAvaliability(QString path, bool checkExistingConfig)
|
||||
LOG(MODULE_INIT, "---> Cannot create a new file or openwrite a file.")
|
||||
return false;
|
||||
} else {
|
||||
testFile.write("qv2ray test file, feel free to remove.");
|
||||
testFile.write("Qv2ray test file, feel free to remove.");
|
||||
testFile.flush();
|
||||
testFile.close();
|
||||
bool removed = testFile.remove();
|
||||
@ -249,13 +249,6 @@ int main(int argc, char *argv[])
|
||||
isDebug = true;
|
||||
SingleApplication::setApplicationName("Qv2ray - DEBUG");
|
||||
#endif
|
||||
|
||||
//
|
||||
if (StartupOption.debugLog) {
|
||||
DEBUG(MODULE_INIT, "Debug log enabled")
|
||||
}
|
||||
|
||||
//
|
||||
SingleApplication _qApp(argc, argv, false, SingleApplication::Mode::User | SingleApplication::Mode::ExcludeAppPath | SingleApplication::Mode::ExcludeAppVersion);
|
||||
// Early initialisation
|
||||
//
|
||||
@ -285,11 +278,14 @@ int main(int argc, char *argv[])
|
||||
"Copyright (c) 2020 Itay Grudev (@itay-grudev): SingleApplication (MIT)" NEWLINE
|
||||
"Copyright (c) 2020 paceholder (@paceholder): nodeeditor (QNodeEditor modified by lhy0403) (BSD-3-Clause)" NEWLINE
|
||||
"Copyright (c) 2019 TheWanderingCoel (@TheWanderingCoel): ShadowClash (launchatlogin) (GPLv3)" NEWLINE
|
||||
"Copyright (c) 2020 Ram Pani (@DuckSoft): **QvRPCBridge** (WTFPL)" NEWLINE
|
||||
"Copyright (c) 2020 Ram Pani (@DuckSoft): QvRPCBridge (WTFPL)" NEWLINE
|
||||
NEWLINE)
|
||||
//
|
||||
LOG(MODULE_INIT, "Qv2ray Start Time: " + QSTRN(QTime::currentTime().msecsSinceStartOfDay()))
|
||||
DEBUG("DEBUG", "WARNING: ============================== This is a debug build, many features are not stable enough. ==============================")
|
||||
//
|
||||
#ifdef QT_DEBUG
|
||||
cout << "WARNING: ============================== This is a debug build, many features are not stable enough. ==============================" << endl;
|
||||
#endif
|
||||
//
|
||||
// Load the language translation list.
|
||||
auto langs = GetFileList(QDir(":/translations"));
|
||||
|
@ -8,9 +8,23 @@ static QQueue<QString> __loggerBuffer;
|
||||
void __QV2RAY_LOG_FUNC__(int type, const std::string &func, int line, const QString &module, const QString &log)
|
||||
{
|
||||
auto logString = "[" + module + "]: " + log;
|
||||
auto funcPrepend = QString::fromStdString(func + ":" + to_string(line) + " ");
|
||||
|
||||
if (StartupOption.debugLog || (isDebug && type == QV2RAY_LOG_DEBUG)) {
|
||||
logString.prepend(QString::fromStdString(func + ":" + to_string(line) + " "));
|
||||
if (isDebug) {
|
||||
// Debug build version, we only print info for DEBUG logs and print ALL info when debugLog presents,
|
||||
if (type == QV2RAY_LOG_DEBUG || StartupOption.debugLog) {
|
||||
logString = logString.prepend(funcPrepend);
|
||||
}
|
||||
} else {
|
||||
// We only process DEBUG log in Release mode
|
||||
if (type == QV2RAY_LOG_DEBUG) {
|
||||
if (StartupOption.debugLog) {
|
||||
logString = logString.prepend(funcPrepend);
|
||||
} else {
|
||||
// Discard debug log in non-debug Qv2ray version with no-debugLog mode.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << logString.toStdString() << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user