diff options
author | Orochimarufan <orochimarufan.x3@gmail.com> | 2014-01-17 22:55:10 +0100 |
---|---|---|
committer | Orochimarufan <orochimarufan.x3@gmail.com> | 2014-01-17 22:55:10 +0100 |
commit | 188d0d58865f5e134b5803bda2cd631a61cf2915 (patch) | |
tree | be2aca8f9205db5f1bfa6e37e183c596f1fe832f /depends/launcher/org/multimc | |
parent | 7b96d74d3b197c23324c5a364809a91ea6800e4e (diff) | |
download | MultiMC-188d0d58865f5e134b5803bda2cd631a61cf2915.tar MultiMC-188d0d58865f5e134b5803bda2cd631a61cf2915.tar.gz MultiMC-188d0d58865f5e134b5803bda2cd631a61cf2915.tar.lz MultiMC-188d0d58865f5e134b5803bda2cd631a61cf2915.tar.xz MultiMC-188d0d58865f5e134b5803bda2cd631a61cf2915.zip |
Improve Console window output.
-> Log Pre- and Post-Launch command happenings
-> Enable the java part to specify the level
TODO: fix logging with mc 1.7's log4j logging infrastructure
Signed-off-by: Orochimarufan <orochimarufan.x3@gmail.com>
Diffstat (limited to 'depends/launcher/org/multimc')
-rw-r--r-- | depends/launcher/org/multimc/EntryPoint.java | 8 | ||||
-rw-r--r-- | depends/launcher/org/multimc/Utils.java | 23 | ||||
-rw-r--r-- | depends/launcher/org/multimc/legacy/LegacyLauncher.java | 28 | ||||
-rw-r--r-- | depends/launcher/org/multimc/onesix/OneSixLauncher.java | 30 |
4 files changed, 56 insertions, 33 deletions
diff --git a/depends/launcher/org/multimc/EntryPoint.java b/depends/launcher/org/multimc/EntryPoint.java index c42e34e7..83f232f1 100644 --- a/depends/launcher/org/multimc/EntryPoint.java +++ b/depends/launcher/org/multimc/EntryPoint.java @@ -71,15 +71,15 @@ public class EntryPoint if(param.equals("legacy")) { m_launcher = new LegacyLauncher(); - System.out.println("Using legacy launcher."); - System.out.println(); + Utils.log("Using legacy launcher."); + Utils.log(); return Action.Launch; } if(param.equals("onesix")) { m_launcher = new OneSixLauncher(); - System.out.println("Using onesix launcher."); - System.out.println(); + Utils.log("Using onesix launcher."); + Utils.log(); return Action.Launch; } else diff --git a/depends/launcher/org/multimc/Utils.java b/depends/launcher/org/multimc/Utils.java index c4d55b6e..df0ef861 100644 --- a/depends/launcher/org/multimc/Utils.java +++ b/depends/launcher/org/multimc/Utils.java @@ -153,4 +153,27 @@ public class Utils } return null; } + + /** + * Log to the MultiMC console + * + * @param message A String containing the message + * @param level A String containing the level name. See MinecraftProcess::getLevel() + */ + public static void log(String message, String level) + { + // Kinda dirty + String tag = "!![" + level + "]!"; + System.out.println(tag + message.replace("\n", "\n" + tag)); + } + + public static void log(String message) + { + log(message, "MultiMC"); + } + + public static void log() + { + System.out.println(); + } } diff --git a/depends/launcher/org/multimc/legacy/LegacyLauncher.java b/depends/launcher/org/multimc/legacy/LegacyLauncher.java index 6a0a3014..1ca37c4a 100644 --- a/depends/launcher/org/multimc/legacy/LegacyLauncher.java +++ b/depends/launcher/org/multimc/legacy/LegacyLauncher.java @@ -102,20 +102,20 @@ public class LegacyLauncher implements Launcher // print the pretty things { - System.out.println("Main Class:"); - System.out.println(mainClass); - System.out.println(); + Utils.log("Main Class:"); + Utils.log(" " + mainClass); + Utils.log(); - System.out.println("Class Path:"); + Utils.log("Class Path:"); for (URL s : classpath) { - System.out.println(s); + Utils.log(" " + s); } - System.out.println(); + Utils.log(); - System.out.println("Native Path:"); - System.out.println(nativesDir); - System.out.println(); + Utils.log("Native Path:"); + Utils.log(" " + nativesDir); + Utils.log(); } URLClassLoader cl = new URLClassLoader(classpath, LegacyLauncher.class.getClassLoader()); @@ -149,7 +149,7 @@ public class LegacyLauncher implements Launcher mcArgs[0] = userName; mcArgs[1] = sessionId; - System.out.println("Launching with applet wrapper..."); + Utils.log("Launching with applet wrapper..."); try { Class<?> MCAppletClass = cl.loadClass("net.minecraft.client.MinecraftApplet"); @@ -158,16 +158,16 @@ public class LegacyLauncher implements Launcher mcWindow.start(mcappl, userName, sessionId, winSize, maximize); } catch (Exception e) { - System.err.println("Applet wrapper failed:"); + Utils.log("Applet wrapper failed:", "Error"); e.printStackTrace(System.err); - System.err.println(); - System.out.println("Falling back to compatibility mode."); + Utils.log(); + Utils.log("Falling back to compatibility mode."); try { mc.getMethod("main", String[].class).invoke(null, (Object) mcArgs); } catch (Exception e1) { - System.err.println("Failed to invoke the Minecraft main class:"); + Utils.log("Failed to invoke the Minecraft main class:", "Fatal"); e1.printStackTrace(System.err); return -1; } diff --git a/depends/launcher/org/multimc/onesix/OneSixLauncher.java b/depends/launcher/org/multimc/onesix/OneSixLauncher.java index f25a3245..d6c80b67 100644 --- a/depends/launcher/org/multimc/onesix/OneSixLauncher.java +++ b/depends/launcher/org/multimc/onesix/OneSixLauncher.java @@ -74,37 +74,37 @@ public class OneSixLauncher implements Launcher // print the pretty things { - System.out.println("Main Class:"); - System.out.println(mainClass); - System.out.println(); + Utils.log("Main Class:"); + Utils.log(" " + mainClass); + Utils.log(); - System.out.println("Native paths:"); + Utils.log("Native paths:"); for (String s : allNativePaths) { - System.out.println(s); + Utils.log(" " + s); } - System.out.println(); + Utils.log(); - System.out.println("Libraries:"); + Utils.log("Libraries:"); for (String s : libraries) { - System.out.println(s); + Utils.log(" " + s); } - System.out.println(); + Utils.log(); if(mods.size() > 0) { - System.out.println("Class Path Mods:"); + Utils.log("Class Path Mods:"); for (String s : mods) { - System.out.println(s); + Utils.log(" " + s); } - System.out.println(); + Utils.log(); } - System.out.println("Params:"); - System.out.println(mcparams.toString()); - System.out.println(); + Utils.log("Params:"); + Utils.log(" " + mcparams.toString()); + Utils.log(); } final ClassLoader cl = ClassLoader.getSystemClassLoader(); |