aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/debug/DebugLogger.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/features/debug/DebugLogger.kt')
-rw-r--r--src/main/kotlin/features/debug/DebugLogger.kt9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/kotlin/features/debug/DebugLogger.kt b/src/main/kotlin/features/debug/DebugLogger.kt
index 9115956..2c8ced0 100644
--- a/src/main/kotlin/features/debug/DebugLogger.kt
+++ b/src/main/kotlin/features/debug/DebugLogger.kt
@@ -1,9 +1,11 @@
package moe.nea.firmament.features.debug
import kotlinx.serialization.serializer
-import net.minecraft.text.Text
+import net.minecraft.network.chat.Component
import moe.nea.firmament.util.MC
+import moe.nea.firmament.util.TestUtil
import moe.nea.firmament.util.collections.InstanceList
+import moe.nea.firmament.util.data.Config
import moe.nea.firmament.util.data.DataHolder
class DebugLogger(val tag: String) {
@@ -11,16 +13,17 @@ class DebugLogger(val tag: String) {
val allInstances = InstanceList<DebugLogger>("DebugLogger")
}
+ @Config
object EnabledLogs : DataHolder<MutableSet<String>>(serializer(), "DebugLogs", ::mutableSetOf)
init {
allInstances.add(this)
}
- fun isEnabled() = DeveloperFeatures.isEnabled && EnabledLogs.data.contains(tag)
+ fun isEnabled() = TestUtil.isInTest || EnabledLogs.data.contains(tag)
fun log(text: String) = log { text }
fun log(text: () -> String) {
if (!isEnabled()) return
- MC.sendChat(Text.literal(text()))
+ MC.sendChat(Component.literal(text()))
}
}