Skip to content

Commit 07e88a3

Browse files
authored
Merge pull request #18 from jannic/add-loglevel-option
Add loglevel option
2 parents 1f7d16e + f4d3d2f commit 07e88a3

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ If accessing from Git, be sure to pull submodules:
6969

7070
Build:
7171

72-
./configure
72+
./configure --qtselect=5
7373
make
7474

7575
Run:

src/app.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,24 @@ class App::Private : public QObject
275275
return;
276276
}
277277

278+
int logLevel = LOG_LEVEL_INFO;
279+
QString logLevelString = options.value("loglevel");
280+
if(!logLevelString.isEmpty())
281+
{
282+
bool ok;
283+
logLevel = logLevelString.toInt(&ok);
284+
if(!ok || logLevel < LOG_LEVEL_ERROR)
285+
{
286+
log_error("parameter to --loglevel invalid: %s", qPrintable(logLevelString));
287+
emit q->quit();
288+
return;
289+
}
290+
}
291+
278292
if(options.contains("verbose"))
279-
log_setOutputLevel(LOG_LEVEL_DEBUG);
280-
else
281-
log_setOutputLevel(LOG_LEVEL_INFO);
293+
logLevel = LOG_LEVEL_DEBUG;
294+
295+
log_setOutputLevel(logLevel);
282296

283297
QString logFile = options.value("logfile");
284298
if(!logFile.isEmpty())

0 commit comments

Comments
 (0)