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
- Host: GitHub
- URL: https://github.com/scarsz/jdaappender
- Owner: Scarsz
- License: unlicense
- Created: 2021-08-05T11:01:18.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-07T01:59:14.000Z (8 months ago)
- Last Synced: 2024-10-11T03:22:09.320Z (7 months ago)
- Topics: java, jda, jda-utilities
- Language: Java
- Homepage:
- Size: 170 KB
- Stars: 7
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```xmlscarsz
https://nexus.scarsz.me/content/repositories/releases/```
```xmlme.scarsz.jdaappender
jda5
1.2.3or
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```