Skip to content

Commit

Permalink
Improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
3arthqu4ke committed Jul 31, 2024
1 parent 6031f18 commit 60d2356
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public static void runAutoConfiguration(FileManager fileManager) {
}
}
} catch (IOException e) {
log.error(e.getMessage());
e.printStackTrace();
log.error(e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ private void load(File file, int id, List<Config> configs) {
try {
configs.add(load(file, id));
} catch (IOException e) {
log.warning("Couldn't read '" + file.getAbsolutePath() + "'");
e.printStackTrace();
log.warn("Couldn't read '" + file.getAbsolutePath() + "'", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void launch() throws IOException, LaunchException, AuthException {
main.setAccessible(true);
main.invoke(null, (Object) gameArgs.toArray(new String[0]));
} catch (InvocationTargetException e) {
e.printStackTrace();
log.error(e);
} catch (Exception e) {
throw new LaunchException("Failed to launch game", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public static void register(RedirectionManager manager) {
field.setAccessible(true);
field.set(obj, true);
} catch (ReflectiveOperationException e) {
//noinspection CallToPrintStackTrace
e.printStackTrace();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public Object invoke(Object obj, String d, Class<?> type, Object... args) {
constructor.setAccessible(true);
return constructor.newInstance();
} catch (SecurityException | ReflectiveOperationException e) {
//noinspection CallToPrintStackTrace
e.printStackTrace();
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.earth.headlessmc.runtime.commands;

import lombok.CustomLog;
import me.earth.headlessmc.api.command.CommandException;
import me.earth.headlessmc.command.CommandUtil;
import me.earth.headlessmc.command.ParseUtil;
Expand All @@ -8,6 +9,7 @@

import java.lang.reflect.Field;

@CustomLog
public class FieldCommand extends AbstractReflectionCommand {
public FieldCommand(Runtime ctx) {
super(ctx, "field", "Gets/sets a field.");
Expand Down Expand Up @@ -45,7 +47,7 @@ protected void execute(Object obj, int address, String... args)
ctx.getVm().set(value, target);
}
} catch (Exception e) {
e.printStackTrace();
log.error(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.earth.headlessmc.runtime.commands;

import lombok.CustomLog;
import lombok.val;
import me.earth.headlessmc.api.command.CommandException;
import me.earth.headlessmc.command.ParseUtil;
Expand All @@ -11,6 +12,7 @@
import java.util.List;
import java.util.stream.Collectors;

@CustomLog
public class NewCommand extends AbstractReflectionCommand {
public NewCommand(Runtime ctx) {
super(ctx, "new", "Creates a new object.");
Expand Down Expand Up @@ -81,7 +83,7 @@ protected void execute(Object o, int address, String... args)
Object value = ctr.newInstance(arguments);
ctx.getVm().set(value, target);
} catch (Exception e) {
e.printStackTrace();
log.error(e);
}
}

Expand Down

0 comments on commit 60d2356

Please sign in to comment.