Skip to content

Commit

Permalink
fix: logger init
Browse files Browse the repository at this point in the history
  • Loading branch information
litwak913 committed Feb 18, 2025
1 parent 98fbde4 commit 8c5d1c0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions desktop/src/cn/harryh/arkpets/BootstrapLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@ public static void main(String[] args) {
// Disable assistive technologies
System.setProperty("javax.accessibility.assistive_technologies", "");
ArgPending.argCache = args;
ArkConfig appConfig = Objects.requireNonNull(ArkConfig.getConfig(), "ArkConfig returns a null instance, please check the config file.");
// Logger
Logger.initialize(Const.LogConfig.logCorePath, Const.LogConfig.logCoreMaxKeep);
Logger.initialize(LogConfig.logDesktopPath, LogConfig.logDesktopMaxKeep);
ArkConfig appConfig = Objects.requireNonNull(ArkConfig.getConfig(), "ArkConfig returns a null instance, please check the config file.");
try {
Logger.setLevel(appConfig.logging_level);
} catch (Exception ignored) {
}
new ArgPending(Const.LogConfig.errorArg, args) {
new ArgPending(LogConfig.errorArg, args) {
protected void process(String command, String addition) {
Logger.setLevel(Logger.ERROR);
}
};
new ArgPending(Const.LogConfig.warnArg, args) {
new ArgPending(LogConfig.warnArg, args) {
protected void process(String command, String addition) {
Logger.setLevel(Logger.WARN);
}
};
new ArgPending(Const.LogConfig.infoArg, args) {
new ArgPending(LogConfig.infoArg, args) {
protected void process(String command, String addition) {
Logger.setLevel(Logger.INFO);
}
};
new ArgPending(Const.LogConfig.debugArg, args) {
new ArgPending(LogConfig.debugArg, args) {
protected void process(String command, String addition) {
Logger.setLevel(Logger.DEBUG);
}
Expand All @@ -63,6 +63,7 @@ protected void process(String command, String addition) {
// If requested to start the core app directly
new ArgPending("--direct-start", args) {
protected void process(String command, String addition) {
Logger.initialize(LogConfig.logCorePath, LogConfig.logCoreMaxKeep);
startCore(appConfig);
System.exit(0);
}
Expand Down

0 comments on commit 8c5d1c0

Please sign in to comment.