Add --logOptions to domain server and assignment client

This commit is contained in:
Dale Glass 2022-06-27 20:07:31 +02:00
parent 2a919e35f4
commit 4204056f2e
2 changed files with 24 additions and 0 deletions

View file

@ -107,6 +107,9 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
const QCommandLineOption parentPIDOption(PARENT_PID_OPTION, "PID of the parent process", "parent-pid");
parser.addOption(parentPIDOption);
const QCommandLineOption logOption("logOptions", "Logging options, comma separated: color,nocolor,process_id,thread_id,milliseconds,keep_repeats,journald,nojournald", "options");
parser.addOption(logOption);
if (!parser.parse(QCoreApplication::arguments())) {
std::cout << parser.errorText().toStdString() << std::endl; // Avoid Qt log spam
parser.showHelp();
@ -123,6 +126,15 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
Q_UNREACHABLE();
}
// We want to configure the logging system as early as possible
auto &logHandler = LogHandler::getInstance();
if (parser.isSet(logOption)) {
if (!logHandler.parseOptions(parser.value(logOption).toUtf8())) {
parser.showHelp();
Q_UNREACHABLE();
}
}
const QVariantMap argumentVariantMap = HifiConfigVariantMap::mergeCLParametersWithJSONConfig(arguments());
unsigned int numForks = 0;

View file

@ -414,6 +414,9 @@ void DomainServer::parseCommandLine(int argc, char* argv[]) {
const QCommandLineOption parentPIDOption(PARENT_PID_OPTION, "PID of the parent process", "parent-pid");
parser.addOption(parentPIDOption);
const QCommandLineOption logOption("logOptions", "Logging options, comma separated: color,nocolor,process_id,thread_id,milliseconds,keep_repeats,journald,nojournald", "options");
parser.addOption(logOption);
QStringList arguments;
for (int i = 0; i < argc; ++i) {
@ -436,6 +439,15 @@ void DomainServer::parseCommandLine(int argc, char* argv[]) {
Q_UNREACHABLE();
}
// We want to configure the logging system as early as possible
auto &logHandler = LogHandler::getInstance();
if (parser.isSet(logOption)) {
if (!logHandler.parseOptions(parser.value(logOption).toUtf8())) {
parser.showHelp();
Q_UNREACHABLE();
}
}
if (parser.isSet(iceServerAddressOption)) {
// parse the IP and port combination for this target
QString hostnamePortString = parser.value(iceServerAddressOption);