aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/debug/DebugLogger.kt
blob: 69a191d2080b4a504cdb31048d7c2260cf4418ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package moe.nea.firmament.features.debug

import net.minecraft.text.Text
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.collections.InstanceList

class DebugLogger(val tag: String) {
    companion object {
        val allInstances = InstanceList<DebugLogger>("DebugLogger")
    }
    init {
    	allInstances.add(this)
    }
    fun isEnabled() = DeveloperFeatures.isEnabled // TODO: allow filtering by tag
    fun log(text: () -> String) {
        if (!isEnabled()) return
        MC.sendChat(Text.literal(text()))
    }
}