A mod providing a simple SLF4J implementation for Mindustry mods/plugins.
All it does it redirecting SLF4J logger (org.slf4j.Logger) to Arc logger (arc.util.Log).
The mod requires:
- Java 8 or above.
- Mindustry v154 or above.
For server owners, this mod provides the slf4md command to manage logging at runtime:
slf4md log-level <logger> <level|clear>: Set or clear a specific logger level.slf4md log-level-list: List all custom log levels currently set.slf4md enable-trace <true|false>: Enable trace logging when debug is active.slf4md show-mod-name <true|false>: Prepend the mod name to log statements.slf4md show-class-name <true|false>: Prepend the class name to log statements.
You only need to "compileOnly" slf4j-api in your build.gradle:
repositories {
mavenCentral()
}
dependencies {
compileOnly("org.slf4j:slf4j-api:$VERSION")
}and add slf4md in the dependencies of your plugin.json:
{
"dependencies": ["slf4md"]
}For testing, I recommend using the toxopid gradle plugin, you will be able to automatically download this mod alongside yours:
Gradle
import com.xpdustry.toxopid.task.GithubAssetDownload
import com.xpdustry.toxopid.task.MindustryExec
plugins {
id "com.xpdustry.toxopid" version "4.x.x"
}
def downloadSlf4md = tasks.register("downloadSlf4md", GithubAssetDownload) {
owner = "xpdustry"
repo = "slf4md"
asset = "slf4md.jar"
version = "v1.x.x"
}
tasks.withType(MindustryExec).configureEach {
mods.from(downloadSlf4md)
}Kotlin
import com.xpdustry.toxopid.task.GithubAssetDownload
import com.xpdustry.toxopid.task.MindustryExec
plugins {
id("com.xpdustry.toxopid") version "4.x.x"
}
val downloadSlf4md by tasks.registering(GithubAssetDownload::class) {
owner = "xpdustry"
repo = "slf4md"
asset = "slf4md.jar"
version = "v1.x.x"
}
tasks.withType<MindustryExec> {
mods.from(downloadSlf4md)
}The mod requires Java 25 for compilation.
./gradlew :mergeJarto compile the plugin into a usable jar (will be located atbuilds/libs/slf4md.jar)../gradlew :runMindustryServerto run the plugin in a local Mindustry server../gradlew :runMindustryDesktopto start a local Mindustry client that will let you test the plugin.