Disable debug logger by default

This commit is contained in:
Him188 2020-08-26 22:31:17 +08:00
parent 31cd77febf
commit 0d8c1f96dc

View File

@ -18,6 +18,8 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI
import net.mamoe.mirai.console.util.ConsoleInternalAPI import net.mamoe.mirai.console.util.ConsoleInternalAPI
import net.mamoe.mirai.utils.DefaultLogger import net.mamoe.mirai.utils.DefaultLogger
import net.mamoe.mirai.utils.currentTimeMillis import net.mamoe.mirai.utils.currentTimeMillis
import net.mamoe.mirai.utils.error
import net.mamoe.mirai.utils.withSwitch
/** /**
* 链接自动保存的 [PluginData]. * 链接自动保存的 [PluginData].
@ -95,16 +97,18 @@ public open class AutoSavePluginData private constructor(
@Suppress("RedundantVisibilityModifier") @Suppress("RedundantVisibilityModifier")
@ConsoleInternalAPI @ConsoleInternalAPI
public final override fun onValueChanged(value: Value<*>) { public final override fun onValueChanged(value: Value<*>) {
debuggingLogger1.error("onValueChanged: $value") debuggingLogger1.error { "onValueChanged: $value" }
if (::owner_.isInitialized) { if (::owner_.isInitialized) {
lastAutoSaveJob_ = owner_.launch(block = updaterBlock) lastAutoSaveJob_ = owner_.launch(block = updaterBlock)
} }
} }
private fun doSave() { private fun doSave() {
debuggingLogger1.error("doSave: ${this::class.qualifiedName}") debuggingLogger1.error { "doSave: ${this::class.qualifiedName}" }
storage_.store(owner_, this) storage_.store(owner_, this)
} }
} }
internal val debuggingLogger1 = DefaultLogger("debug") internal val debuggingLogger1 by lazy {
DefaultLogger("debug").withSwitch(false)
}