An open API service indexing awesome lists of open source software.

https://github.com/scarsz/jdaappender

Library for Java applications that use JDA to easily stream the logging output to a text channel on Discord
https://github.com/scarsz/jdaappender

java jda jda-utilities

Last synced: 2 months ago
JSON representation

Library for Java applications that use JDA to easily stream the logging output to a text channel on Discord

Awesome Lists containing this project

README

        

# JDA Appender
Library for Java applications that use [JDA](https://github.com/DV8FromTheWorld/JDA) to easily stream
the logging output of the application to a text channel on Discord.

[insert screenshot here]

# Usage
Using default values:

```java
ChannelLoggingHandler handler = new ChannelLoggingHandler(() -> jda.getTextChannelById(System.getenv("CHANNEL")))
.attach() // attach to SLF4J JDK logging if present, else Log4j if present, else standard out/err
.schedule(); // schedule handler to flush output asynchronously every 1.5 seconds
```

Customizing config values, such as adding a logger name mapping:

```java
ChannelLoggingHandler handler = new ChannelLoggingHandler(() -> jda.getTextChannelById(System.getenv("CHANNEL")), config -> {
config.setColored(true); // enable coloring of different log levels, default true
config.setSplitCodeBlockForLinks(false); // split the output code blocks when a link is present, default false
config.setAllowLinkEmbeds(true); // when splitting code blocks for links, allow the links to have an embed, default true
config.mapLoggerName("net.dv8tion.jda", "JDA"); // add a mapping for logger names "net.dv8tion.jda*" to just be "JDA"
}).attach().schedule();
```

# Artifact
```xml

scarsz
https://nexus.scarsz.me/content/repositories/releases/

```
```xml

me.scarsz.jdaappender
jda5
1.2.3

or

me.scarsz.jdaappender
jda4
1.2.3

```

# Using with SLF4J-backed apps with minimal effort (JDA, ...)

Use `slf4j-jdk14` as your SLF4J logging backend. This will forward SLF4J messages to java.util.logging and can be
picked up by JDAAppender with `ChannelLoggingHandler#attachJavaLogging`.

```xml

org.slf4j
slf4j-jdk14
1.7.31

```