Skip to content

SLF4J implementation for Mindustry.

License

Notifications You must be signed in to change notification settings

xpdustry/slf4md

Repository files navigation

slf4md

Downloads Mindustry 8.0 Discord

Description

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).

Installation

The mod requires:

  • Java 8 or above.
  • Mindustry v154 or above.

Usage

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.

For developers

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)
}

Building

The mod requires Java 25 for compilation.

  • ./gradlew :mergeJar to compile the plugin into a usable jar (will be located at builds/libs/slf4md.jar).
  • ./gradlew :runMindustryServer to run the plugin in a local Mindustry server.
  • ./gradlew :runMindustryDesktop to start a local Mindustry client that will let you test the plugin.

About

SLF4J implementation for Mindustry.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages