Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Slf4j logging #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/gg/flyte/neptune/Neptune.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import gg.flyte.neptune.command.CommandDispatcher;
import gg.flyte.neptune.command.CommandManager;
import gg.flyte.neptune.util.Logger;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Guild;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
Expand All @@ -15,7 +15,7 @@
import java.util.List;

public final class Neptune {
public static final @NotNull Logger LOGGER = new Logger();
public static final @NotNull Logger LOGGER = LoggerFactory.getLogger(Neptune.class);

private final @NotNull JDA jda;
private final @NotNull CommandManager manager;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/gg/flyte/neptune/command/CommandDispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.reflections.scanners.ResourcesScanner;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ConfigurationBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.lang.reflect.Field;
Expand All @@ -25,13 +27,12 @@
import java.util.*;
import java.util.stream.Collectors;

import static gg.flyte.neptune.Neptune.LOGGER;

public final class CommandDispatcher {
private final @NotNull JDA jda;
private final @NotNull CommandManager commandManager;
private final @NotNull List<Guild> guilds;
private final boolean registerAllListeners;
private static final Logger LOGGER = LoggerFactory.getLogger(CommandDispatcher.class);

public CommandDispatcher(@NotNull JDA jda, Object mainClass, @NotNull CommandManager commandManager, @NotNull List<Guild> guilds, boolean clearCommands, boolean registerAllListeners) throws InstantiationException, IllegalAccessException, InvocationTargetException, IOException, ClassNotFoundException, NoSuchMethodException {
LOGGER.debug("Instantiating dispatcher...");
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/gg/flyte/neptune/command/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

import static gg.flyte.neptune.Neptune.LOGGER;

public final class CommandManager extends ListenerAdapter {
private final @NotNull Map<String, CommandMapping> commands = new HashMap<>();
private static final Logger LOGGER = LoggerFactory.getLogger(CommandManager.class);

public void addCommand(String command, CommandMapping mapping) {
commands.put(command, mapping);
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/gg/flyte/neptune/command/CommandMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
import gg.flyte.neptune.annotation.Optional;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;

import static gg.flyte.neptune.Neptune.LOGGER;

public final class CommandMapping {
private final @NotNull Method method;
private final @NotNull Object classInstance;

private final @NotNull NamedParameter[] parameters;

private static final Logger LOGGER = LoggerFactory.getLogger(CommandMapping.class);

public CommandMapping(@NotNull Method method, @NotNull Object classInstance) {
this.method = method;
this.classInstance = classInstance;
Expand Down
19 changes: 0 additions & 19 deletions src/main/java/gg/flyte/neptune/util/Logger.java

This file was deleted.