added more logging for parameters

master
Stefan Dollase 2016-01-05 22:34:47 +01:00
parent 4c61d2e990
commit f98bd57e31
3 changed files with 24 additions and 9 deletions

View File

@ -47,7 +47,7 @@ public class Amidst {
parser.parseArgument(args);
run(metadata, parameters, parser);
} catch (CmdLineException e) {
printLongVersionString(metadata);
System.out.println(metadata.getVersion().createLongVersionString());
System.err.println(e.getMessage());
parser.printUsage(System.out);
System.exit(2);
@ -63,22 +63,21 @@ public class Amidst {
private static void run(AmidstMetaData metadata,
CommandLineParameters parameters, CmdLineParser parser) {
initFileLogger(parameters.logFile);
String versionString = metadata.getVersion().createLongVersionString();
if (parameters.printHelp) {
printLongVersionString(metadata);
System.out.println(versionString);
parser.printUsage(System.out);
} else if (parameters.printVersion) {
printLongVersionString(metadata);
System.out.println(versionString);
} else {
Log.i(versionString);
startApplication(parameters, metadata);
}
}
private static void printLongVersionString(AmidstMetaData metadata) {
System.out.println(metadata.getVersion().createLongVersionString());
}
private static void initFileLogger(String filename) {
if (filename != null) {
Log.i("using log file: '" + filename + "'");
Log.addListener("file", new FileLogger(new File(filename)));
}
}

View File

@ -19,6 +19,7 @@ public class SeedHistoryLogger {
private File getHistoryFile(String filename) {
if (filename != null) {
Log.i("using seed history file: '" + filename + "'");
return new File(filename);
} else {
return null;

View File

@ -15,10 +15,17 @@ import com.google.gson.JsonSyntaxException;
@Immutable
public class BiomeColorProfileDirectory {
public static BiomeColorProfileDirectory create(String root) {
BiomeColorProfileDirectory result = new BiomeColorProfileDirectory(
getRoot(root));
Log.i("using biome color profiles at: '" + result.getRoot() + "'");
return result;
}
private static File getRoot(String root) {
if (root != null) {
return new BiomeColorProfileDirectory(new File(root));
return new File(root);
} else {
return new BiomeColorProfileDirectory(DEFAULT_ROOT_DIRECTORY);
return DEFAULT_ROOT_DIRECTORY;
}
}
@ -34,6 +41,14 @@ public class BiomeColorProfileDirectory {
this.defaultProfile = new File(root, "default.json");
}
public File getRoot() {
return root;
}
public File getDefaultProfile() {
return defaultProfile;
}
public boolean isValid() {
return root.isDirectory();
}