Commit 91f621aecc5766c6bf7f6456e4a15a35ed695687

Authored by Mumfrey
1 parent d71dab5e

add verbosity levels to logger to support reduced log output on server

java/common/com/mumfrey/liteloader/api/manager/APIRegistry.java
@@ -14,6 +14,7 @@ import com.mumfrey.liteloader.api.exceptions.InvalidAPIStateException; @@ -14,6 +14,7 @@ import com.mumfrey.liteloader.api.exceptions.InvalidAPIStateException;
14 import com.mumfrey.liteloader.launch.LoaderEnvironment; 14 import com.mumfrey.liteloader.launch.LoaderEnvironment;
15 import com.mumfrey.liteloader.launch.LoaderProperties; 15 import com.mumfrey.liteloader.launch.LoaderProperties;
16 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 16 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  17 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
17 18
18 /** 19 /**
19 * This is where we register API classes during early startup before baking the registered list into an 20 * This is where we register API classes during early startup before baking the registered list into an
@@ -56,7 +57,7 @@ public final class APIRegistry @@ -56,7 +57,7 @@ public final class APIRegistry
56 57
57 if (!this.registeredAPIClasses.contains(apiClass)) 58 if (!this.registeredAPIClasses.contains(apiClass))
58 { 59 {
59 - LiteLoaderLogger.info("Registering API provider class %s", apiClass); 60 + LiteLoaderLogger.info(Verbosity.REDUCED, "Registering API provider class %s", apiClass);
60 this.registeredAPIClasses.add(apiClass); 61 this.registeredAPIClasses.add(apiClass);
61 } 62 }
62 } 63 }
@@ -86,7 +87,7 @@ public final class APIRegistry @@ -86,7 +87,7 @@ public final class APIRegistry
86 87
87 if (!this.instances.containsKey(identifier)) 88 if (!this.instances.containsKey(identifier))
88 { 89 {
89 - LiteLoaderLogger.info("API provider class '%s' provides API '%s'", apiClassName, identifier); 90 + LiteLoaderLogger.info(Verbosity.REDUCED, "API provider class '%s' provides API '%s'", apiClassName, identifier);
90 this.instances.put(identifier, api); 91 this.instances.put(identifier, api);
91 return api; 92 return api;
92 } 93 }
@@ -124,7 +125,7 @@ public final class APIRegistry @@ -124,7 +125,7 @@ public final class APIRegistry
124 125
125 for (LiteAPI api : allAPIs) 126 for (LiteAPI api : allAPIs)
126 { 127 {
127 - LiteLoaderLogger.info("Initialising API '%s' ...", api.getIdentifier()); 128 + LiteLoaderLogger.info(Verbosity.REDUCED, "Initialising API '%s' ...", api.getIdentifier());
128 api.init(this.environment, this.properties); 129 api.init(this.environment, this.properties);
129 } 130 }
130 131
java/common/com/mumfrey/liteloader/core/LiteLoader.java
@@ -53,6 +53,7 @@ import com.mumfrey.liteloader.permissions.PermissionsManagerServer; @@ -53,6 +53,7 @@ import com.mumfrey.liteloader.permissions.PermissionsManagerServer;
53 import com.mumfrey.liteloader.transformers.event.EventTransformer; 53 import com.mumfrey.liteloader.transformers.event.EventTransformer;
54 import com.mumfrey.liteloader.util.Input; 54 import com.mumfrey.liteloader.util.Input;
55 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 55 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  56 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
56 57
57 /** 58 /**
58 * LiteLoader is a simple loader which loads and provides useful callbacks to 59 * LiteLoader is a simple loader which loads and provides useful callbacks to
@@ -817,7 +818,7 @@ public final class LiteLoader @@ -817,7 +818,7 @@ public final class LiteLoader
817 { 818 {
818 int totalMods = this.enumerator.modsToLoadCount(); 819 int totalMods = this.enumerator.modsToLoadCount();
819 int totalTweaks = this.enumerator.getInjectedTweaks().size(); 820 int totalTweaks = this.enumerator.getInjectedTweaks().size();
820 - LiteLoaderLogger.info("Discovered %d total mod(s), injected %d tweak(s)", totalMods, totalTweaks); 821 + LiteLoaderLogger.info(Verbosity.REDUCED, "Discovered %d total mod(s), injected %d tweak(s)", totalMods, totalTweaks);
821 822
822 if (totalMods > 0) 823 if (totalMods > 0)
823 { 824 {
@@ -826,7 +827,7 @@ public final class LiteLoader @@ -826,7 +827,7 @@ public final class LiteLoader
826 } 827 }
827 else 828 else
828 { 829 {
829 - LiteLoaderLogger.info("No mod classes were found. Not loading any mods."); 830 + LiteLoaderLogger.info(Verbosity.REDUCED, "No mod classes were found. Not loading any mods.");
830 } 831 }
831 832
832 // Initialises the required hooks for loaded mods 833 // Initialises the required hooks for loaded mods
@@ -939,7 +940,7 @@ public final class LiteLoader @@ -939,7 +940,7 @@ public final class LiteLoader
939 940
940 private void onShutDown() 941 private void onShutDown()
941 { 942 {
942 - LiteLoaderLogger.info("LiteLoader is shutting down, shutting down core providers and syncing configuration"); 943 + LiteLoaderLogger.info(Verbosity.REDUCED, "LiteLoader is shutting down, shutting down core providers and syncing configuration");
943 944
944 this.shutdownObservers.all().onShutDown(); 945 this.shutdownObservers.all().onShutDown();
945 946
@@ -991,14 +992,14 @@ public final class LiteLoader @@ -991,14 +992,14 @@ public final class LiteLoader
991 992
992 static final void invokeInit() 993 static final void invokeInit()
993 { 994 {
994 - LiteLoaderLogger.info("LiteLoader begin INIT..."); 995 + LiteLoaderLogger.info(Verbosity.REDUCED, "LiteLoader begin INIT...");
995 996
996 LiteLoader.instance.onInit(); 997 LiteLoader.instance.onInit();
997 } 998 }
998 999
999 static final void invokePostInit() 1000 static final void invokePostInit()
1000 { 1001 {
1001 - LiteLoaderLogger.info("LiteLoader begin POSTINIT..."); 1002 + LiteLoaderLogger.info(Verbosity.REDUCED, "LiteLoader begin POSTINIT...");
1002 1003
1003 LiteLoader.instance.onPostInit(); 1004 LiteLoader.instance.onPostInit();
1004 } 1005 }
java/common/com/mumfrey/liteloader/core/LiteLoaderBootstrap.java
@@ -32,6 +32,7 @@ import com.mumfrey.liteloader.launch.LoaderEnvironment; @@ -32,6 +32,7 @@ import com.mumfrey.liteloader.launch.LoaderEnvironment;
32 import com.mumfrey.liteloader.launch.LoaderProperties; 32 import com.mumfrey.liteloader.launch.LoaderProperties;
33 import com.mumfrey.liteloader.launch.StartupEnvironment; 33 import com.mumfrey.liteloader.launch.StartupEnvironment;
34 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 34 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  35 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
35 36
36 /** 37 /**
37 * LiteLoaderBootstrap is responsible for managing the early part of the LiteLoader startup process, this is 38 * LiteLoaderBootstrap is responsible for managing the early part of the LiteLoader startup process, this is
@@ -272,20 +273,20 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP @@ -272,20 +273,20 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP
272 this.classLoader = classLoader; 273 this.classLoader = classLoader;
273 this.loadTweaks = loadTweaks; 274 this.loadTweaks = loadTweaks;
274 275
275 - LiteLoaderLogger.info("LiteLoader begin PREINIT..."); 276 + LiteLoaderLogger.info(Verbosity.REDUCED, "LiteLoader begin PREINIT...");
276 277
277 // Set up the bootstrap 278 // Set up the bootstrap
278 if (!this.prepare()) return; 279 if (!this.prepare()) return;
279 280
280 - LiteLoaderLogger.info("LiteLoader %s starting up...", LiteLoaderVersion.CURRENT.getLoaderVersion()); 281 + LiteLoaderLogger.info(Verbosity.REDUCED, "LiteLoader %s starting up...", LiteLoaderVersion.CURRENT.getLoaderVersion());
281 282
282 // Print the branding version if any was provided 283 // Print the branding version if any was provided
283 if (this.branding != null) 284 if (this.branding != null)
284 { 285 {
285 - LiteLoaderLogger.info("Active Pack: %s", this.branding); 286 + LiteLoaderLogger.info(Verbosity.REDUCED, "Active Pack: %s", this.branding);
286 } 287 }
287 288
288 - LiteLoaderLogger.info("Java reports OS=\"%s\"", System.getProperty("os.name").toLowerCase()); 289 + LiteLoaderLogger.info(Verbosity.REDUCED, "Java reports OS=\"%s\"", System.getProperty("os.name").toLowerCase());
289 290
290 this.enabledModsList = EnabledModsList.createFrom(this.enabledModsFile); 291 this.enabledModsList = EnabledModsList.createFrom(this.enabledModsFile);
291 this.enabledModsList.processModsList(this.profile, modsToLoad); 292 this.enabledModsList.processModsList(this.profile, modsToLoad);
@@ -293,7 +294,7 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP @@ -293,7 +294,7 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP
293 this.enumerator = this.spawnEnumerator(classLoader); 294 this.enumerator = this.spawnEnumerator(classLoader);
294 this.enumerator.onPreInit(); 295 this.enumerator.onPreInit();
295 296
296 - LiteLoaderLogger.info("LiteLoader PREINIT complete"); 297 + LiteLoaderLogger.info(Verbosity.REDUCED, "LiteLoader PREINIT complete");
297 } 298 }
298 299
299 /** 300 /**
java/common/com/mumfrey/liteloader/core/LiteLoaderEnumerator.java
@@ -34,6 +34,7 @@ import com.mumfrey.liteloader.launch.LiteLoaderTweaker; @@ -34,6 +34,7 @@ import com.mumfrey.liteloader.launch.LiteLoaderTweaker;
34 import com.mumfrey.liteloader.launch.LoaderEnvironment; 34 import com.mumfrey.liteloader.launch.LoaderEnvironment;
35 import com.mumfrey.liteloader.launch.LoaderProperties; 35 import com.mumfrey.liteloader.launch.LoaderProperties;
36 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 36 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  37 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
37 38
38 /** 39 /**
39 * The enumerator performs all mod discovery functions for LiteLoader, this includes locating mod files to load 40 * The enumerator performs all mod discovery functions for LiteLoader, this includes locating mod files to load
@@ -521,7 +522,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator @@ -521,7 +522,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
521 { 522 {
522 this.checkState(EnumeratorState.DISCOVER, "registerDisabledContainer"); 523 this.checkState(EnumeratorState.DISCOVER, "registerDisabledContainer");
523 524
524 - LiteLoaderLogger.info(reason.getMessage(container)); 525 + LiteLoaderLogger.info(Verbosity.REDUCED, reason.getMessage(container));
525 526
526 this.enabledContainers.remove(container.getIdentifier()); 527 this.enabledContainers.remove(container.getIdentifier());
527 this.disabledContainers.put(container.getIdentifier(), new NonMod(container, false)); 528 this.disabledContainers.put(container.getIdentifier(), new NonMod(container, false));
@@ -539,7 +540,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator @@ -539,7 +540,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
539 540
540 if (!container.isEnabled(this.environment)) 541 if (!container.isEnabled(this.environment))
541 { 542 {
542 - LiteLoaderLogger.info("Mod %s is disabled for profile %s, not injecting tranformers", container.getIdentifier(), this.environment.getProfile()); 543 + LiteLoaderLogger.info(Verbosity.REDUCED, "Mod %s is disabled for profile %s, not injecting tranformers", container.getIdentifier(), this.environment.getProfile());
543 return false; 544 return false;
544 } 545 }
545 546
@@ -575,10 +576,10 @@ public class LiteLoaderEnumerator implements LoaderEnumerator @@ -575,10 +576,10 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
575 { 576 {
576 String tweakClass = container.getTweakClassName(); 577 String tweakClass = container.getTweakClassName();
577 int tweakPriority = container.getTweakPriority(); 578 int tweakPriority = container.getTweakPriority();
578 - LiteLoaderLogger.info("Mod file '%s' provides tweakClass '%s', adding to Launch queue with priority %d", container.getName(), tweakClass, tweakPriority); 579 + LiteLoaderLogger.info(Verbosity.REDUCED, "Mod file '%s' provides tweakClass '%s', adding to Launch queue with priority %d", container.getName(), tweakClass, tweakPriority);
579 if (this.tweaker.addCascadedTweaker(tweakClass, tweakPriority)) 580 if (this.tweaker.addCascadedTweaker(tweakClass, tweakPriority))
580 { 581 {
581 - LiteLoaderLogger.info("tweakClass '%s' was successfully added", tweakClass); 582 + LiteLoaderLogger.info(Verbosity.REDUCED, "tweakClass '%s' was successfully added", tweakClass);
582 container.injectIntoClassPath(this.classLoader, true); 583 container.injectIntoClassPath(this.classLoader, true);
583 584
584 if (container.isExternalJar()) 585 if (container.isExternalJar())
@@ -616,10 +617,10 @@ public class LiteLoaderEnumerator implements LoaderEnumerator @@ -616,10 +617,10 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
616 { 617 {
617 for (String classTransformerClass : classTransformerClasses) 618 for (String classTransformerClass : classTransformerClasses)
618 { 619 {
619 - LiteLoaderLogger.info("Mod file '%s' provides classTransformer '%s', adding to class loader", container.getName(), classTransformerClass); 620 + LiteLoaderLogger.info(Verbosity.REDUCED, "Mod file '%s' provides classTransformer '%s', adding to class loader", container.getName(), classTransformerClass);
620 if (this.tweaker.getTransformerManager().injectTransformer(classTransformerClass)) 621 if (this.tweaker.getTransformerManager().injectTransformer(classTransformerClass))
621 { 622 {
622 - LiteLoaderLogger.info("classTransformer '%s' was successfully added", classTransformerClass); 623 + LiteLoaderLogger.info(Verbosity.REDUCED, "classTransformer '%s' was successfully added", classTransformerClass);
623 container.injectIntoClassPath(this.classLoader, true); 624 container.injectIntoClassPath(this.classLoader, true);
624 } 625 }
625 } 626 }
@@ -711,7 +712,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator @@ -711,7 +712,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
711 catch (OutdatedLoaderException ex) 712 catch (OutdatedLoaderException ex)
712 { 713 {
713 classes.clear(); 714 classes.clear();
714 - LiteLoaderLogger.info("Error searching in '%s', missing API component '%s', your loader is probably out of date", container, ex.getMessage()); 715 + LiteLoaderLogger.info(Verbosity.REDUCED, "Error searching in '%s', missing API component '%s', your loader is probably out of date", container, ex.getMessage());
715 } 716 }
716 catch (Throwable th) 717 catch (Throwable th)
717 { 718 {
@@ -868,7 +869,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator @@ -868,7 +869,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
868 circularDependencySet.add(base.getIdentifier()); 869 circularDependencySet.add(base.getIdentifier());
869 870
870 boolean result = this.checkDependencies(base, base, circularDependencySet); 871 boolean result = this.checkDependencies(base, base, circularDependencySet);
871 - LiteLoaderLogger.info("Dependency check for %s %s", base.getIdentifier(), result ? "passed" : "failed"); 872 + LiteLoaderLogger.info(Verbosity.REDUCED, "Dependency check for %s %s", base.getIdentifier(), result ? "passed" : "failed");
872 873
873 return result; 874 return result;
874 } 875 }
java/common/com/mumfrey/liteloader/core/LiteLoaderInterfaceManager.java
@@ -18,6 +18,7 @@ import com.mumfrey.liteloader.core.event.HandlerList; @@ -18,6 +18,7 @@ import com.mumfrey.liteloader.core.event.HandlerList;
18 import com.mumfrey.liteloader.interfaces.FastIterable; 18 import com.mumfrey.liteloader.interfaces.FastIterable;
19 import com.mumfrey.liteloader.interfaces.InterfaceRegistry; 19 import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
20 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 20 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  21 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
21 22
22 /** 23 /**
23 * The interface manager handles the allocation of interface consumers (implementors) to interface providers. During 24 * The interface manager handles the allocation of interface consumers (implementors) to interface providers. During
@@ -247,7 +248,7 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry @@ -247,7 +248,7 @@ public class LiteLoaderInterfaceManager implements InterfaceRegistry
247 { 248 {
248 for (InterfaceProvider provider : apiInterfaceProviders) 249 for (InterfaceProvider provider : apiInterfaceProviders)
249 { 250 {
250 - LiteLoaderLogger.info("Registering interface provider %s for API %s", provider.getClass().getName(), api.getName()); 251 + LiteLoaderLogger.info(Verbosity.REDUCED, "Registering interface provider %s for API %s", provider.getClass().getName(), api.getName());
251 if (this.registerProvider(provider)) 252 if (this.registerProvider(provider))
252 { 253 {
253 this.providerToAPIMap.put(provider, api); 254 this.providerToAPIMap.put(provider, api);
java/common/com/mumfrey/liteloader/core/LiteLoaderMods.java
@@ -25,6 +25,7 @@ import com.mumfrey.liteloader.launch.LoaderProperties; @@ -25,6 +25,7 @@ import com.mumfrey.liteloader.launch.LoaderProperties;
25 import com.mumfrey.liteloader.modconfig.ConfigManager; 25 import com.mumfrey.liteloader.modconfig.ConfigManager;
26 import com.mumfrey.liteloader.modconfig.ConfigStrategy; 26 import com.mumfrey.liteloader.modconfig.ConfigStrategy;
27 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 27 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  28 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
28 29
29 /** 30 /**
30 * Separated from the core loader class for encapsulation purposes 31 * Separated from the core loader class for encapsulation purposes
@@ -478,7 +479,7 @@ public class LiteLoaderMods @@ -478,7 +479,7 @@ public class LiteLoaderMods
478 */ 479 */
479 void loadMod(Mod mod) throws InstantiationException, IllegalAccessException 480 void loadMod(Mod mod) throws InstantiationException, IllegalAccessException
480 { 481 {
481 - LiteLoaderLogger.info("Loading mod from %s", mod.getModClassName()); 482 + LiteLoaderLogger.info(Verbosity.REDUCED, "Loading mod from %s", mod.getModClassName());
482 483
483 LiteMod newMod = mod.newInstance(); 484 LiteMod newMod = mod.newInstance();
484 485
@@ -559,7 +560,7 @@ public class LiteLoaderMods @@ -559,7 +560,7 @@ public class LiteLoaderMods
559 { 560 {
560 LiteMod instance = mod.getMod(); 561 LiteMod instance = mod.getMod();
561 562
562 - LiteLoaderLogger.info("Initialising mod %s version %s", instance.getName(), instance.getVersion()); 563 + LiteLoaderLogger.info(Verbosity.REDUCED, "Initialising mod %s version %s", instance.getName(), instance.getVersion());
563 LoadingProgress.incLiteLoaderProgress("Initialising mod %s version %s...", instance.getName(), instance.getVersion()); 564 LoadingProgress.incLiteLoaderProgress("Initialising mod %s version %s...", instance.getName(), instance.getVersion());
564 565
565 this.onPreInitMod(instance); 566 this.onPreInitMod(instance);
java/common/com/mumfrey/liteloader/core/api/EnumeratorModuleClassPath.java
@@ -13,6 +13,7 @@ import com.mumfrey.liteloader.interfaces.ModularEnumerator; @@ -13,6 +13,7 @@ import com.mumfrey.liteloader.interfaces.ModularEnumerator;
13 import com.mumfrey.liteloader.launch.LoaderEnvironment; 13 import com.mumfrey.liteloader.launch.LoaderEnvironment;
14 import com.mumfrey.liteloader.launch.LoaderProperties; 14 import com.mumfrey.liteloader.launch.LoaderProperties;
15 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 15 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  16 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
16 17
17 /** 18 /**
18 * Enumerator module which searches for mods on the classpath 19 * Enumerator module which searches for mods on the classpath
@@ -97,7 +98,7 @@ public class EnumeratorModuleClassPath implements EnumeratorModule @@ -97,7 +98,7 @@ public class EnumeratorModuleClassPath implements EnumeratorModule
97 } 98 }
98 else 99 else
99 { 100 {
100 - LiteLoaderLogger.info("Mod %s is disabled or missing a required dependency, not injecting tranformers", classPathMod.getIdentifier()); 101 + LiteLoaderLogger.info(Verbosity.REDUCED, "Mod %s is disabled or missing a required dependency, not injecting tranformers", classPathMod.getIdentifier());
101 } 102 }
102 } 103 }
103 } 104 }
@@ -120,7 +121,7 @@ public class EnumeratorModuleClassPath implements EnumeratorModule @@ -120,7 +121,7 @@ public class EnumeratorModuleClassPath implements EnumeratorModule
120 @Override 121 @Override
121 public void registerMods(ModularEnumerator enumerator, LaunchClassLoader classLoader) 122 public void registerMods(ModularEnumerator enumerator, LaunchClassLoader classLoader)
122 { 123 {
123 - LiteLoaderLogger.info("Discovering mods on class path..."); 124 + LiteLoaderLogger.info(Verbosity.REDUCED, "Discovering mods on class path...");
124 LoadingProgress.incTotalLiteLoaderProgress(this.loadableMods.size()); 125 LoadingProgress.incTotalLiteLoaderProgress(this.loadableMods.size());
125 126
126 for (LoadableMod<File> classPathMod : this.loadableMods) 127 for (LoadableMod<File> classPathMod : this.loadableMods)
java/common/com/mumfrey/liteloader/core/api/EnumeratorModuleFolder.java
@@ -24,6 +24,7 @@ import com.mumfrey.liteloader.interfaces.TweakContainer; @@ -24,6 +24,7 @@ import com.mumfrey.liteloader.interfaces.TweakContainer;
24 import com.mumfrey.liteloader.launch.LoaderEnvironment; 24 import com.mumfrey.liteloader.launch.LoaderEnvironment;
25 import com.mumfrey.liteloader.launch.LoaderProperties; 25 import com.mumfrey.liteloader.launch.LoaderProperties;
26 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 26 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  27 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
27 28
28 /** 29 /**
29 * Enumerator module which searches for mods and tweaks in a folder 30 * Enumerator module which searches for mods and tweaks in a folder
@@ -296,7 +297,7 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule @@ -296,7 +297,7 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule
296 } 297 }
297 else 298 else
298 { 299 {
299 - LiteLoaderLogger.info("Not adding invalid or version-mismatched mod file: %s", modFile); 300 + LiteLoaderLogger.info(Verbosity.REDUCED, "Not adding invalid or version-mismatched mod file: %s", modFile);
300 enumerator.registerBadContainer(modFile, "Version not supported"); 301 enumerator.registerBadContainer(modFile, "Version not supported");
301 } 302 }
302 } 303 }
@@ -335,12 +336,12 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule @@ -335,12 +336,12 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule
335 { 336 {
336 if (enumerator.registerModContainer(modFile)) 337 if (enumerator.registerModContainer(modFile))
337 { 338 {
338 - LiteLoaderLogger.info("Adding newest valid mod file '%s' at revision %.4f", modFile, modFile.getRevision()); 339 + LiteLoaderLogger.info(Verbosity.REDUCED, "Adding newest valid mod file '%s' at revision %.4f", modFile, modFile.getRevision());
339 this.loadableMods.add(modFile); 340 this.loadableMods.add(modFile);
340 } 341 }
341 else 342 else
342 { 343 {
343 - LiteLoaderLogger.info("Not adding valid mod file '%s', the specified mod is disabled or missing a required dependency", modFile); 344 + LiteLoaderLogger.info(Verbosity.REDUCED, "Not adding valid mod file '%s', the specified mod is disabled or missing a required dependency", modFile);
344 } 345 }
345 346
346 if (this.loadTweaks) 347 if (this.loadTweaks)
@@ -383,7 +384,7 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule @@ -383,7 +384,7 @@ public class EnumeratorModuleFolder implements FilenameFilter, EnumeratorModule
383 @Override 384 @Override
384 public void registerMods(ModularEnumerator enumerator, LaunchClassLoader classLoader) 385 public void registerMods(ModularEnumerator enumerator, LaunchClassLoader classLoader)
385 { 386 {
386 - LiteLoaderLogger.info("Discovering mods in valid mod files..."); 387 + LiteLoaderLogger.info(Verbosity.REDUCED, "Discovering mods in valid mod files...");
387 LoadingProgress.incTotalLiteLoaderProgress(this.loadableMods.size()); 388 LoadingProgress.incTotalLiteLoaderProgress(this.loadableMods.size());
388 389
389 for (LoadableMod<?> modFile : this.loadableMods) 390 for (LoadableMod<?> modFile : this.loadableMods)
java/common/com/mumfrey/liteloader/launch/ClassTransformerManager.java
@@ -12,6 +12,7 @@ import net.minecraft.launchwrapper.LaunchClassLoader; @@ -12,6 +12,7 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
12 import net.minecraft.launchwrapper.LogWrapper; 12 import net.minecraft.launchwrapper.LogWrapper;
13 13
14 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 14 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  15 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
15 16
16 /** 17 /**
17 * Manages injection of required and optional transformers 18 * Manages injection of required and optional transformers
@@ -141,7 +142,7 @@ public class ClassTransformerManager @@ -141,7 +142,7 @@ public class ClassTransformerManager
141 { 142 {
142 for (String requiredTransformerClassName : this.requiredTransformers) 143 for (String requiredTransformerClassName : this.requiredTransformers)
143 { 144 {
144 - LiteLoaderLogger.info("Injecting required class transformer '%s'", requiredTransformerClassName); 145 + LiteLoaderLogger.info(Verbosity.REDUCED, "Injecting required class transformer '%s'", requiredTransformerClassName);
145 this.injectTransformer(classLoader, requiredTransformerClassName); 146 this.injectTransformer(classLoader, requiredTransformerClassName);
146 } 147 }
147 } 148 }
@@ -158,7 +159,7 @@ public class ClassTransformerManager @@ -158,7 +159,7 @@ public class ClassTransformerManager
158 159
159 for (String transformerClassName : this.downstreamTransformers) 160 for (String transformerClassName : this.downstreamTransformers)
160 { 161 {
161 - LiteLoaderLogger.info("Injecting additional class transformer class '%s'", transformerClassName); 162 + LiteLoaderLogger.info(Verbosity.REDUCED, "Injecting additional class transformer class '%s'", transformerClassName);
162 this.injectTransformer(classLoader, transformerClassName); 163 this.injectTransformer(classLoader, transformerClassName);
163 } 164 }
164 165
java/common/com/mumfrey/liteloader/launch/LiteLoaderTweaker.java
@@ -17,6 +17,7 @@ import net.minecraft.launchwrapper.LaunchClassLoader; @@ -17,6 +17,7 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
17 import com.mumfrey.liteloader.transformers.event.EventInfo; 17 import com.mumfrey.liteloader.transformers.event.EventInfo;
18 import com.mumfrey.liteloader.util.SortableValue; 18 import com.mumfrey.liteloader.util.SortableValue;
19 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 19 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  20 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
20 21
21 /** 22 /**
22 * LiteLoader tweak class 23 * LiteLoader tweak class
@@ -283,7 +284,7 @@ public class LiteLoaderTweaker implements ITweaker @@ -283,7 +284,7 @@ public class LiteLoaderTweaker implements ITweaker
283 */ 284 */
284 private void onPrepare(List<String> args, File gameDirectory, File assetsDirectory, String profile) 285 private void onPrepare(List<String> args, File gameDirectory, File assetsDirectory, String profile)
285 { 286 {
286 - LiteLoaderLogger.info("Bootstrapping LiteLoader " + LiteLoaderTweaker.VERSION); 287 + LiteLoaderLogger.info(Verbosity.REDUCED, "Bootstrapping LiteLoader " + LiteLoaderTweaker.VERSION);
287 288
288 try 289 try
289 { 290 {
@@ -422,7 +423,7 @@ public class LiteLoaderTweaker implements ITweaker @@ -422,7 +423,7 @@ public class LiteLoaderTweaker implements ITweaker
422 for (SortableValue<String> tweak : this.sortedCascadingTweaks) 423 for (SortableValue<String> tweak : this.sortedCascadingTweaks)
423 { 424 {
424 String tweakClass = tweak.getValue(); 425 String tweakClass = tweak.getValue();
425 - LiteLoaderLogger.info("Injecting tweak class %s with priority %d", tweakClass, tweak.getPriority()); 426 + LiteLoaderLogger.info(Verbosity.REDUCED, "Injecting tweak class %s with priority %d", tweakClass, tweak.getPriority());
426 this.injectTweakClass(tweakClass, tweakClasses, tweakers); 427 this.injectTweakClass(tweakClass, tweakClasses, tweakers);
427 } 428 }
428 } 429 }
java/common/com/mumfrey/liteloader/launch/LiteLoaderTweakerServer.java
@@ -3,8 +3,16 @@ package com.mumfrey.liteloader.launch; @@ -3,8 +3,16 @@ package com.mumfrey.liteloader.launch;
3 import java.io.File; 3 import java.io.File;
4 import java.util.List; 4 import java.util.List;
5 5
  6 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  7 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
  8 +
6 public class LiteLoaderTweakerServer extends LiteLoaderTweaker 9 public class LiteLoaderTweakerServer extends LiteLoaderTweaker
7 { 10 {
  11 + public LiteLoaderTweakerServer()
  12 + {
  13 + LiteLoaderLogger.verbosity = Verbosity.REDUCED;
  14 + }
  15 +
8 @Override 16 @Override
9 protected StartupEnvironment spawnStartupEnvironment(List<String> args, File gameDirectory, File assetsDirectory, String profile) 17 protected StartupEnvironment spawnStartupEnvironment(List<String> args, File gameDirectory, File assetsDirectory, String profile)
10 { 18 {
java/common/com/mumfrey/liteloader/transformers/event/EventTransformer.java
@@ -27,6 +27,7 @@ import com.mumfrey.liteloader.transformers.ClassTransformer; @@ -27,6 +27,7 @@ import com.mumfrey.liteloader.transformers.ClassTransformer;
27 import com.mumfrey.liteloader.transformers.ObfProvider; 27 import com.mumfrey.liteloader.transformers.ObfProvider;
28 import com.mumfrey.liteloader.transformers.access.AccessorTransformer; 28 import com.mumfrey.liteloader.transformers.access.AccessorTransformer;
29 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 29 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  30 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
30 31
31 /** 32 /**
32 * EventTransformer is the spiritual successor to the CallbackInjectionTransformer and is a more advanced and flexible 33 * EventTransformer is the spiritual successor to the CallbackInjectionTransformer and is a more advanced and flexible
@@ -362,15 +363,9 @@ public final class EventTransformer extends ClassTransformer @@ -362,15 +363,9 @@ public final class EventTransformer extends ClassTransformer
362 private void injectEventsAt(ClassNode classNode, MethodNode method, AbstractInsnNode injectionPoint, Injection injection) 363 private void injectEventsAt(ClassNode classNode, MethodNode method, AbstractInsnNode injectionPoint, Injection injection)
363 { 364 {
364 Event head = injection.getHead(); 365 Event head = injection.getHead();
365 -  
366 - if (head.isVerbose())  
367 - {  
368 - LiteLoaderLogger.info("Injecting %s[x%d] in %s in %s", head.getName(), injection.size(), method.name, ClassTransformer.getSimpleClassName(classNode));  
369 - }  
370 - else  
371 - {  
372 - LiteLoaderLogger.debug("Injecting %s[x%d] in %s in %s", head.getName(), injection.size(), method.name, ClassTransformer.getSimpleClassName(classNode));  
373 - } 366 +
  367 + Verbosity verbosity = head.isVerbose() ? Verbosity.NORMAL : Verbosity.VERBOSE;
  368 + LiteLoaderLogger.info(verbosity, "Injecting %s[x%d] in %s in %s", head.getName(), injection.size(), method.name, ClassTransformer.getSimpleClassName(classNode));
374 369
375 MethodNode handler = head.inject(injectionPoint, injection.isCancellable(), this.globalEventID, injection.captureLocals(), injection.getLocalTypes()); 370 MethodNode handler = head.inject(injectionPoint, injection.isCancellable(), this.globalEventID, injection.captureLocals(), injection.getLocalTypes());
376 injection.addEventsToHandler(handler); 371 injection.addEventsToHandler(handler);
java/common/com/mumfrey/liteloader/transformers/event/json/ModEventInjectionTransformer.java
@@ -8,6 +8,7 @@ import com.mumfrey.liteloader.transformers.event.InjectionPoint; @@ -8,6 +8,7 @@ import com.mumfrey.liteloader.transformers.event.InjectionPoint;
8 import com.mumfrey.liteloader.transformers.event.MethodInfo; 8 import com.mumfrey.liteloader.transformers.event.MethodInfo;
9 import com.mumfrey.liteloader.transformers.event.json.ModEvents.ModEventDefinition; 9 import com.mumfrey.liteloader.transformers.event.json.ModEvents.ModEventDefinition;
10 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 10 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  11 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
11 12
12 /** 13 /**
13 * Event transformer which manages injections of mod events specified via events.json in the mod container 14 * Event transformer which manages injections of mod events specified via events.json in the mod container
@@ -62,7 +63,7 @@ public class ModEventInjectionTransformer extends EventInjectionTransformer @@ -62,7 +63,7 @@ public class ModEventInjectionTransformer extends EventInjectionTransformer
62 def.injectIntoClassPath(); 63 def.injectIntoClassPath();
63 } 64 }
64 65
65 - LiteLoaderLogger.info("Registering events for mod with id %s", def.getIdentifier()); 66 + LiteLoaderLogger.info(Verbosity.REDUCED, "Registering events for mod with id %s", def.getIdentifier());
66 events.register(this); 67 events.register(this);
67 def.onEventsInjected(); 68 def.onEventsInjected();
68 } 69 }
java/common/com/mumfrey/liteloader/util/log/LiteLoaderLogger.java
@@ -35,6 +35,31 @@ public class LiteLoaderLogger extends AbstractAppender @@ -35,6 +35,31 @@ public class LiteLoaderLogger extends AbstractAppender
35 35
36 private static Throwable lastThrowable; 36 private static Throwable lastThrowable;
37 37
  38 + /**
  39 + * Provides some wiggle-room within log4j's Level so we can have different levels of logging on the same, um.. Level
  40 + */
  41 + public static enum Verbosity
  42 + {
  43 + VERBOSE(3),
  44 + NORMAL(2),
  45 + REDUCED(1),
  46 + SILENT(0);
  47 +
  48 + protected final int level;
  49 +
  50 + private Verbosity(int level)
  51 + {
  52 + this.level = level;
  53 + }
  54 +
  55 + public int getLevel()
  56 + {
  57 + return this.level;
  58 + }
  59 + }
  60 +
  61 + public static Verbosity verbosity = LiteLoaderLogger.DEBUG ? Verbosity.VERBOSE : Verbosity.NORMAL;
  62 +
38 static 63 static
39 { 64 {
40 LiteLoaderLogger.logger.addAppender(new LiteLoaderLogger()); 65 LiteLoaderLogger.logger.addAppender(new LiteLoaderLogger());
@@ -132,8 +157,13 @@ public class LiteLoaderLogger extends AbstractAppender @@ -132,8 +157,13 @@ public class LiteLoaderLogger extends AbstractAppender
132 return lastThrowableWrapped; 157 return lastThrowableWrapped;
133 } 158 }
134 159
135 - private static void log(Level level, String format, Object... data) 160 + private static void log(Level level, Verbosity verbosity, String format, Object... data)
136 { 161 {
  162 + if (verbosity.level > LiteLoaderLogger.verbosity.level)
  163 + {
  164 + return;
  165 + }
  166 +
137 try 167 try
138 { 168 {
139 LiteLoaderLogger.logger.log(level, String.format(format, data)); 169 LiteLoaderLogger.logger.log(level, String.format(format, data));
@@ -144,8 +174,13 @@ public class LiteLoaderLogger extends AbstractAppender @@ -144,8 +174,13 @@ public class LiteLoaderLogger extends AbstractAppender
144 } 174 }
145 } 175 }
146 176
147 - private static void log(Level level, Throwable th, String format, Object... data) 177 + private static void log(Level level, Verbosity verbosity, Throwable th, String format, Object... data)
148 { 178 {
  179 + if (verbosity.level > LiteLoaderLogger.verbosity.level)
  180 + {
  181 + return;
  182 + }
  183 +
149 LiteLoaderLogger.lastThrowable = th; 184 LiteLoaderLogger.lastThrowable = th;
150 185
151 try 186 try
@@ -165,16 +200,26 @@ public class LiteLoaderLogger extends AbstractAppender @@ -165,16 +200,26 @@ public class LiteLoaderLogger extends AbstractAppender
165 200
166 public static void severe(String format, Object... data) 201 public static void severe(String format, Object... data)
167 { 202 {
168 - LiteLoaderLogger.log(Level.ERROR, format, data); 203 + LiteLoaderLogger.severe(Verbosity.REDUCED, format, data);
  204 + }
  205 +
  206 + public static void severe(Verbosity verbosity, String format, Object... data)
  207 + {
  208 + LiteLoaderLogger.log(Level.ERROR, verbosity, format, data);
169 } 209 }
170 210
171 public static void severe(Throwable th, String format, Object... data) 211 public static void severe(Throwable th, String format, Object... data)
172 { 212 {
  213 + LiteLoaderLogger.severe(Verbosity.REDUCED, th, format, data);
  214 + }
  215 +
  216 + public static void severe(Verbosity verbosity, Throwable th, String format, Object... data)
  217 + {
173 LiteLoaderLogger.lastThrowable = th; 218 LiteLoaderLogger.lastThrowable = th;
174 219
175 try 220 try
176 { 221 {
177 - LiteLoaderLogger.log(Level.ERROR, th, format, data); 222 + LiteLoaderLogger.log(Level.ERROR, verbosity, th, format, data);
178 } 223 }
179 catch (LinkageError ex) // This happens because of ClassLoader scope derpiness during the PREINIT and INIT phases 224 catch (LinkageError ex) // This happens because of ClassLoader scope derpiness during the PREINIT and INIT phases
180 { 225 {
@@ -189,16 +234,26 @@ public class LiteLoaderLogger extends AbstractAppender @@ -189,16 +234,26 @@ public class LiteLoaderLogger extends AbstractAppender
189 234
190 public static void warning(String format, Object... data) 235 public static void warning(String format, Object... data)
191 { 236 {
192 - LiteLoaderLogger.log(Level.WARN, format, data); 237 + LiteLoaderLogger.warning(Verbosity.REDUCED, format, data);
  238 + }
  239 +
  240 + public static void warning(Verbosity verbosity, String format, Object... data)
  241 + {
  242 + LiteLoaderLogger.log(Level.WARN, verbosity, format, data);
193 } 243 }
194 244
195 public static void warning(Throwable th, String format, Object... data) 245 public static void warning(Throwable th, String format, Object... data)
196 { 246 {
  247 + LiteLoaderLogger.warning(Verbosity.REDUCED, th, format, data);
  248 + }
  249 +
  250 + public static void warning(Verbosity verbosity, Throwable th, String format, Object... data)
  251 + {
197 LiteLoaderLogger.lastThrowable = th; 252 LiteLoaderLogger.lastThrowable = th;
198 253
199 try 254 try
200 { 255 {
201 - LiteLoaderLogger.log(Level.WARN, th, format, data); 256 + LiteLoaderLogger.log(Level.WARN, verbosity, th, format, data);
202 } 257 }
203 catch (LinkageError ex) // This happens because of ClassLoader scope derpiness during the PREINIT and INIT phases 258 catch (LinkageError ex) // This happens because of ClassLoader scope derpiness during the PREINIT and INIT phases
204 { 259 {
@@ -213,7 +268,12 @@ public class LiteLoaderLogger extends AbstractAppender @@ -213,7 +268,12 @@ public class LiteLoaderLogger extends AbstractAppender
213 268
214 public static void info(String format, Object... data) 269 public static void info(String format, Object... data)
215 { 270 {
216 - LiteLoaderLogger.log(Level.INFO, format, data); 271 + LiteLoaderLogger.info(Verbosity.NORMAL, format, data);
  272 + }
  273 +
  274 + public static void info(Verbosity verbosity, String format, Object... data)
  275 + {
  276 + LiteLoaderLogger.log(Level.INFO, verbosity, format, data);
217 } 277 }
218 278
219 public static void debug(String format, Object... data) 279 public static void debug(String format, Object... data)