remove jline and adjust logging

This commit is contained in:
tueem 2025-02-06 11:54:13 +01:00
parent 2b3423c1c9
commit 614ca976b9
Signed by: tueem
GPG Key ID: 65C8667EC17A88FB
5 changed files with 3 additions and 44 deletions

View File

@ -32,7 +32,6 @@ dependencies {
implementation(libs.logback)
implementation(libs.log4jtoslf4j)
implementation(libs.jultoslf4j)
implementation(libs.jline)
implementation(libs.marinaralib)
implementation(libs.marinarajavacord)

View File

@ -1,12 +1,8 @@
package net.tomatentum.tomatenmusic3;
import java.io.IOException;
import org.javacord.api.DiscordApi;
import org.javacord.api.DiscordApiBuilder;
import org.javacord.api.entity.intent.Intent;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -26,7 +22,6 @@ public class App {
private Config config;
private DiscordApi client;
private Logger logger = LoggerFactory.getLogger(getClass());
private Terminal terminal;
private Marinara marinara;
@ -37,7 +32,6 @@ public class App {
LoggerContext loggerctx = (LoggerContext) LoggerFactory.getILoggerFactory();
if (config.isDevelopment())
loggerctx.getLogger("root").setLevel(Level.DEBUG);
initJline();
}
public void connect() {
@ -49,15 +43,6 @@ public class App {
logger.info("connected as {}", client.getYourself().getName());
}
private void initJline() {
try {
this.terminal = TerminalBuilder.terminal();
} catch (IOException e) {
e.printStackTrace();
}
JlineAppender.Terminal = this.terminal;
}
private void initMarinara() {
this.marinara = Marinara.load(new JavacordWrapper(client));

View File

@ -1,21 +0,0 @@
package net.tomatentum.tomatenmusic3;
import java.io.PrintWriter;
import org.jline.terminal.Terminal;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
public class JlineAppender extends ConsoleAppender<ILoggingEvent> {
public static Terminal Terminal;
@Override
protected void append(ILoggingEvent event) {
PrintWriter terminalWriter = Terminal.writer();
terminalWriter.write(new String(super.encoder.encode(event)));
terminalWriter.flush();
}
}

View File

@ -1,11 +1,11 @@
<configuration>
<appender name="jline" class="net.tomatentum.tomatenmusic3.JlineAppender">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{STRICT} %-30.-30t %-56([%boldWhite(%logger{40})]) %highlight(%p): %msg%n</pattern>
<pattern>%d{STRICT} %-20.-20t %-46([%boldWhite(%logger{30})]) %highlight(%p): %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="jline" />
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -2,7 +2,6 @@
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
[versions]
guava = "33.0.0-jre"
junit-jupiter = "5.10.2"
javacord = "3.8.0"
dotenv = "3.0.0"
@ -10,11 +9,9 @@ logback = "1.5.15"
slf4j = "2.0.16"
log4jtoslf4j = "2.24.3"
jultoslf4j = "2.0.16"
jline = "3.26.3"
marinara = "1.0.0-RC1-9d88ca9"
[libraries]
guava = { module = "com.google.guava:guava", version.ref = "guava" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
javacord = { module = "org.javacord:javacord", version.ref = "javacord" }
dotenv = { module = "io.github.cdimascio:dotenv-java", version.ref = "dotenv"}
@ -22,7 +19,6 @@ logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback"}
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j"}
log4jtoslf4j = { module = "org.apache.logging.log4j:log4j-to-slf4j", version.ref = "log4jtoslf4j"}
jultoslf4j = { module = "org.slf4j:jul-to-slf4j", version.ref = "jultoslf4j"}
jline = { module = "org.jline:jline", version.ref = "jline"}
marinaralib = { module = "net.tomatentum.Marinara:lib-dev", version.ref = "marinara"}
marinarajavacord = { module = "net.tomatentum.Marinara:wrapper-javacord-dev", version.ref = "marinara"}