Skip to content

Commit

Permalink
Fixed Shadowjar Twitch Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
beanbeanjuice committed Jul 22, 2024
1 parent 119c3ab commit dd99d65
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
11 changes: 3 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ dependencies {

implementation("org.apache.logging.log4j", "log4j-api", "2.23.1")
implementation("org.apache.logging.log4j", "log4j-core", "2.23.1")
implementation("org.slf4j", "slf4j-reload4j", "2.0.13")
implementation("org.apache.logging.log4j", "log4j-slf4j18-impl", "2.18.0") // JDA logs.
implementation("org.apache.logging.log4j", "log4j-slf4j2-impl", "2.23.1") // JDA logging.

implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")

Expand All @@ -105,13 +104,9 @@ dependencies {
tasks.withType<ShadowJar> {
minimize {
exclude(dependency("io.github.xanthic.cache:.*:.*"))
exclude(dependency("org.apache.logging.log4j:.*:.*"))
exclude(dependency("com.github.twitch4j:.*:.*"))
}

relocate("net.dv8tion", "com.beanbeanjuice.cafebot.libs.net.dv8tion")
relocate("org.slf4j", "com.beanbeanjuice.cafebot.libs.org.slf4j")
relocate("org.apache.logging.log4j", "com.beanbeanjuice.cafebot.libs.org.apache.logging.log4j")
relocate("com.github.twitch4j", "com.beanbeanjuice.cafebot.libs.com.github.twitch4j")
relocate("com.fasterxml.jackson.core", "com.beanbeanjuice.cafebot.libs.com.fasterxml.jackson.core")
}

configure<ProcessResources>("processResources") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

/**
* A class used for logging.
*
* @author beanbeanjuice
* @since v3.0.1
*/
public class LogManager {

private final Time time;
Expand Down Expand Up @@ -323,6 +317,7 @@ public void log(@NotNull Class<?> c, @NotNull LogLevel logLevel, @NotNull String
checkFiles();

Logger logger = org.apache.logging.log4j.LogManager.getLogger(c);
// Logger logger = LoggerFactory.getLogger(c);

switch (logLevel) {
case INFO, LOADING, OKAY -> logger.info(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public void handleStartup(final CafeBot cafeBot) {
this.addStream(channel);
cafeBot.getLogger().log(TwitchHandler.class, LogLevel.DEBUG, String.format("Adding Twitch Channel: %s", channel), false, false);
});
}).exceptionallyAsync((e) -> {
cafeBot.getLogger().log(TwitchHandler.class, LogLevel.ERROR, String.format("Error Adding Twitch Channels: %s", e.getMessage()), e);
return null;
});
}

Expand Down

0 comments on commit dd99d65

Please sign in to comment.