Feat: add log file on disk
This commit is contained in:
@@ -64,6 +64,7 @@ public class SettingsLoader {
|
||||
HEADLESS("headless"),
|
||||
UI("ui"),
|
||||
THEME("theme"),
|
||||
LOG_DIR("log-dir"),
|
||||
DISABLE_LARGE_DOWNLOADS("disable-large-downloads");
|
||||
|
||||
String propertyName;
|
||||
@@ -98,6 +99,7 @@ public class SettingsLoader {
|
||||
public static final String ARG_EXTRAS = "-extras";
|
||||
public static final String ARG_UI = "-ui";
|
||||
public static final String ARG_CONFIG = "-config";
|
||||
public static final String ARG_LOG_DIRECTORY = "-logdir";
|
||||
public static final String ARG_VERSION = "--version";
|
||||
public static final String ARG_SHOW_GPU = "--show-gpu";
|
||||
public static final String ARG_NO_SYSTRAY = "--no-systray";
|
||||
@@ -114,7 +116,7 @@ public class SettingsLoader {
|
||||
private Option<String> login;
|
||||
|
||||
private Option<String> password;
|
||||
|
||||
private Option<String> logDir;
|
||||
private Option<String> proxy;
|
||||
private Option<String> hostname;
|
||||
private Option<String> computeMethod;
|
||||
@@ -165,7 +167,6 @@ public class SettingsLoader {
|
||||
theme = setValue(theme_, theme, ARG_THEME);
|
||||
disableLargeDownloads = setValue(disableLargeDownloads_.toString(), disableLargeDownloads, ARG_DISABLE_LARGE_DOWNLOADS);
|
||||
|
||||
|
||||
if (cores_ > 0) {
|
||||
cores = setValue(cores_.toString(), cores, ARG_CORES);
|
||||
}
|
||||
@@ -285,6 +286,7 @@ public class SettingsLoader {
|
||||
setProperty(prop, configFileProp, PropertyNames.UI, ui);
|
||||
setProperty(prop, configFileProp, PropertyNames.THEME, theme);
|
||||
setProperty(prop, configFileProp, PropertyNames.DISABLE_LARGE_DOWNLOADS, disableLargeDownloads);
|
||||
setProperty(prop, configFileProp, PropertyNames.LOG_DIR, logDir);
|
||||
prop.store(output, null);
|
||||
}
|
||||
catch (IOException io) {
|
||||
@@ -389,6 +391,8 @@ public class SettingsLoader {
|
||||
|
||||
disableLargeDownloads = loadConfigOption(prop, PropertyNames.DISABLE_LARGE_DOWNLOADS, disableLargeDownloads, ARG_DISABLE_LARGE_DOWNLOADS);
|
||||
|
||||
logDir = loadConfigOption(prop, PropertyNames.LOG_DIR, logDir, ARG_LOG_DIRECTORY);
|
||||
|
||||
if (prop.containsKey(PropertyNames.PRIORITY.propertyName)) {
|
||||
int prio = Integer.parseInt(prop.getProperty(PropertyNames.PRIORITY.propertyName));
|
||||
if (priority == null) {
|
||||
@@ -534,6 +538,10 @@ public class SettingsLoader {
|
||||
if (config.isAutoSignIn() == false && autoSignIn != null) {
|
||||
config.setAutoSignIn(Boolean.parseBoolean(autoSignIn.getValue()));
|
||||
}
|
||||
|
||||
if (config.getLogDirectory() != null && logDir != null) {
|
||||
config.setLogDirectory(logDir.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private void initWithDefaults() {
|
||||
@@ -556,11 +564,12 @@ public class SettingsLoader {
|
||||
this.theme = null;
|
||||
this.cores = new Option<>(String.valueOf(defaultConfigValues.getNbCores()), ARG_CORES);
|
||||
this.disableLargeDownloads = new Option<>(String.valueOf(defaultConfigValues.isDisableLargeDownloads()), ARG_DISABLE_LARGE_DOWNLOADS);
|
||||
this.logDir = null;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return String.format(
|
||||
"SettingsLoader [path=%s, login=%s, password=%s, computeMethod=%s, gpu=%s, cacheDir=%s, sharedZip=%s, theme=%s, priority=%d, autosign=%s, usetray=%s, headless=%s, disableLargeDownloads=%s]",
|
||||
path, login, password, computeMethod, gpu, cacheDir, sharedZip, theme, priority, autoSignIn, useSysTray, headless, disableLargeDownloads);
|
||||
"SettingsLoader [path=%s, login=%s, password=%s, computeMethod=%s, gpu=%s, cacheDir=%s, sharedZip=%s, theme=%s, priority=%d, autosign=%s, usetray=%s, headless=%s, disableLargeDownloads=%s, logDir=%s]",
|
||||
path, login, password, computeMethod, gpu, cacheDir, sharedZip, theme, priority, autoSignIn, useSysTray, headless, disableLargeDownloads, logDir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user