fix: remove debug level and use debug level logging from command line
This commit is contained in:
parent
66c10b68d7
commit
b9fdbd61ab
7 changed files with 58 additions and 49 deletions
|
@ -2,7 +2,7 @@
|
|||
<configuration default="false" name="Launch" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.atlauncher.App" />
|
||||
<module name="ATLauncher.main" />
|
||||
<option name="PROGRAM_PARAMETERS" value="--debug --debug-level 5 --disable-error-reporting --no-launcher-update" />
|
||||
<option name="PROGRAM_PARAMETERS" value="--debug --disable-error-reporting --no-launcher-update" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/testLauncher" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
|
@ -15,4 +15,4 @@
|
|||
<option name="Gradle.BeforeRunTask" enabled="true" tasks="createTestLauncherDir" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<configuration default="false" name="Launch (Dev)" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.atlauncher.App" />
|
||||
<module name="ATLauncher.main" />
|
||||
<option name="PROGRAM_PARAMETERS" value="--debug --debug-level 5 --disable-error-reporting --no-launcher-update --base-launcher-domain=https://atlauncher.test --base-cdn-domain=files.atlauncher.test --base-cdn-path=/ --allow-all-ssl-certs" />
|
||||
<option name="PROGRAM_PARAMETERS" value="--debug --disable-error-reporting --no-launcher-update --base-launcher-domain=https://atlauncher.test --base-cdn-domain=files.atlauncher.test --base-cdn-path=/ --allow-all-ssl-certs" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/testLauncher" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
|
@ -15,4 +15,4 @@
|
|||
<option name="Gradle.BeforeRunTask" enabled="true" tasks="createTestLauncherDir" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
|
|
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
|
@ -9,7 +9,7 @@
|
|||
"projectName": "ATLauncher",
|
||||
"cwd": "${workspaceFolder}/testLauncher",
|
||||
"preLaunchTask": "createTestLauncherDir",
|
||||
"args": "--debug --debug-level 5 --disable-error-reporting --no-launcher-update"
|
||||
"args": "--debug --disable-error-reporting --no-launcher-update"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
|
@ -19,7 +19,7 @@
|
|||
"projectName": "ATLauncher",
|
||||
"cwd": "${workspaceFolder}/testLauncher/dev",
|
||||
"preLaunchTask": "createTestLauncherDir",
|
||||
"args": "--debug --debug-level 5 --disable-error-reporting --no-launcher-update --base-launcher-domain=https://atlauncher.test --base-cdn-domain=files.atlauncher.test --base-cdn-path=/ --allow-all-ssl-certs"
|
||||
"args": "--debug --disable-error-reporting --no-launcher-update --base-launcher-domain=https://atlauncher.test --base-cdn-domain=files.atlauncher.test --base-cdn-path=/ --allow-all-ssl-certs"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ If you want to run the launcher while developing with it, you can use your IDE (
|
|||
Alternatively you can run:
|
||||
|
||||
```sh
|
||||
./gradlew run --args="--debug --debug-level 3 --working-dir=testLauncher"
|
||||
./gradlew run --args="--debug --working-dir=testLauncher"
|
||||
```
|
||||
|
||||
Setting the `--working-dir=testLauncher` argument is necessary as it will ensure that the launchers files are not
|
||||
|
|
|
@ -17,6 +17,46 @@
|
|||
*/
|
||||
package com.atlauncher;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.ProxySelector;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.ToolTipManager;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.text.DefaultEditorKit;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.mini2Dx.gettext.GetText;
|
||||
|
||||
import com.atlauncher.builders.HTMLBuilder;
|
||||
import com.atlauncher.constants.Constants;
|
||||
import com.atlauncher.data.Instance;
|
||||
|
@ -39,14 +79,12 @@ import com.atlauncher.utils.OS;
|
|||
import com.atlauncher.utils.Utils;
|
||||
import com.formdev.flatlaf.extras.FlatInspector;
|
||||
import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
|
||||
|
||||
import io.github.asyncronous.toast.Toaster;
|
||||
import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
import net.arikia.dev.drpc.DiscordEventHandlers;
|
||||
import net.arikia.dev.drpc.DiscordRPC;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.mini2Dx.gettext.GetText;
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.CentralProcessor;
|
||||
import oshi.hardware.GraphicsCard;
|
||||
|
@ -54,28 +92,6 @@ import oshi.hardware.HardwareAbstractionLayer;
|
|||
import oshi.software.os.OSProcess;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.DefaultEditorKit;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Main entry point for the application, Java runs the main method here when the
|
||||
* application is launched.
|
||||
|
@ -841,8 +857,6 @@ public class App {
|
|||
parser.accepts("close-launcher", "If the launcher should be closed after launching an instance.")
|
||||
.withOptionalArg().ofType(Boolean.class);
|
||||
parser.accepts("debug", "If debug logging should be enabled.").withOptionalArg().ofType(Boolean.class);
|
||||
parser.accepts("debug-level", "The level of debug logging that should be logged.").withRequiredArg()
|
||||
.ofType(Integer.class);
|
||||
parser.accepts("launch",
|
||||
"The name of an instance to automatically launch. Can be the instances directory name in the file system or the full name of the instance.")
|
||||
.withRequiredArg().ofType(String.class);
|
||||
|
@ -867,6 +881,10 @@ public class App {
|
|||
System.exit(0);
|
||||
}
|
||||
|
||||
if (options.has("debug")) {
|
||||
// Configurator.setAllLevels(LogManager.getRootLogger().getName(), Level.DEBUG);
|
||||
}
|
||||
|
||||
if (options.has("updated")) {
|
||||
wasUpdated = true;
|
||||
}
|
||||
|
|
|
@ -22,14 +22,13 @@ import java.awt.event.MouseEvent;
|
|||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import com.atlauncher.builders.HTMLBuilder;
|
||||
import com.atlauncher.network.Analytics;
|
||||
import com.atlauncher.utils.OS;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.mini2Dx.gettext.GetText;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.atlauncher.builders.HTMLBuilder;
|
||||
import com.atlauncher.network.Analytics;
|
||||
import com.atlauncher.utils.OS;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class DebugModePanel extends AbstractToolPanel {
|
||||
|
@ -53,7 +52,7 @@ public class DebugModePanel extends AbstractToolPanel {
|
|||
// Handle left-click
|
||||
Analytics.sendEvent("DebugMode", "Run", "Tool");
|
||||
|
||||
OS.relaunchInDebugMode(e.isShiftDown() ? 5 : 3);
|
||||
OS.relaunchInDebugMode();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -540,19 +540,11 @@ public enum OS {
|
|||
public static void restartLauncher() {
|
||||
OS.restartLauncher(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* This restarts the launcher in debug mode.
|
||||
*/
|
||||
public static void relaunchInDebugMode() {
|
||||
relaunchInDebugMode(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* This restarts the launcher in debug mode.
|
||||
*/
|
||||
public static void relaunchInDebugMode(int level) {
|
||||
restartLauncher(new ArrayList<>(Arrays.asList("--debug", "--debug-level=" + level)));
|
||||
restartLauncher(new ArrayList<>(Arrays.asList("--debug")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue