From 544e11747c49d3175109ea2644eba947e0e6fc83 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Mon, 26 Oct 2020 23:20:10 +0800 Subject: [PATCH] Redesign LoggerController --- .../console/MiraiConsoleImplementation.kt | 8 ++-- .../mirai/console/data/AutoSavePluginData.kt | 15 ++++++- .../extensions/LoggerControllerProvider.kt | 35 +++++++++++++++ .../MiraiConsoleImplementationBridge.kt | 26 +++++++---- .../data/builtins/ConsoleDataScope.kt | 10 +++-- .../internal/data/builtins/LoggerConfig.kt | 29 +----------- .../logging/LoggerControllerDelegate.kt | 21 +++++++++ .../internal/logging/LoggerControllerImpl.kt | 11 ++--- .../logging/LoggerControllerTrusted.kt | 18 ++++++++ .../mirai/console/logging/LogPriority.kt | 44 +++++++++++++++++++ .../mirai/console/logging/LoggerController.kt | 17 ------- .../mamoe/mirai/console/TestMiraiConosle.kt | 5 +-- .../MiraiConsoleImplementationTerminal.kt | 4 +- 13 files changed, 171 insertions(+), 72 deletions(-) create mode 100644 backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/LoggerControllerProvider.kt create mode 100644 backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerDelegate.kt create mode 100644 backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerTrusted.kt create mode 100644 backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LogPriority.kt diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/MiraiConsoleImplementation.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/MiraiConsoleImplementation.kt index 3bee16ef3..01d0b7b63 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/MiraiConsoleImplementation.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/MiraiConsoleImplementation.kt @@ -26,6 +26,7 @@ import net.mamoe.mirai.console.util.ConsoleInput import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.LoginSolver +import net.mamoe.mirai.utils.MiraiLogger import java.nio.file.Path import java.util.* import java.util.concurrent.locks.ReentrantLock @@ -164,11 +165,12 @@ public interface MiraiConsoleImplementation : CoroutineScope { public fun createLoginSolver(requesterBot: Long, configuration: BotConfiguration): LoginSolver /** - * 日志控制器 + * 创建一个 [MiraiLogger]. * - * @see [LoggerControllerImpl] + * **注意**: [MiraiConsole] 会将 [net.mamoe.mirai.utils.DefaultLogger] 设置为 `MiraiConsole::createLogger`. + * 因此不要在 [createLogger] 中调用 [net.mamoe.mirai.utils.DefaultLogger] */ - public val loggerController: LoggerController + public fun createLogger(identity: String?): MiraiLogger public companion object { internal lateinit var instance: MiraiConsoleImplementation diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginData.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginData.kt index f081af4d2..58fbbd195 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginData.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/AutoSavePluginData.kt @@ -36,6 +36,8 @@ public open class AutoSavePluginData private constructor( private lateinit var owner_: AutoSavePluginDataHolder private val autoSaveIntervalMillis_: LongRange get() = owner_.autoSaveIntervalMillis private lateinit var storage_: PluginDataStorage + private var authSaveJob: Job? = null + private var completionHandle: DisposableHandle? = null public final override val saveName: String get() = _saveName @@ -54,18 +56,27 @@ public open class AutoSavePluginData private constructor( ?: throw IllegalArgumentException("Cannot find a serial name for ${this::class}") } + @ConsoleExperimentalApi + public fun destroy() { + completionHandle?.dispose() + authSaveJob?.cancel() + completionHandle = null + authSaveJob = null + } + @ConsoleExperimentalApi override fun onInit(owner: PluginDataHolder, storage: PluginDataStorage) { check(owner is AutoSavePluginDataHolder) { "owner must be AutoSavePluginDataHolder for AutoSavePluginData" } if (this::storage_.isInitialized) { check(storage == this.storage_) { "AutoSavePluginData is already initialized with one storage and cannot be reinitialized with another." } + destroy() // Destroy old jobs } this.storage_ = storage this.owner_ = owner - owner_.coroutineContext[Job]?.invokeOnCompletion { + completionHandle = owner_.coroutineContext[Job]?.invokeOnCompletion { kotlin.runCatching { doSave() }.onFailure { e -> @@ -80,7 +91,7 @@ public open class AutoSavePluginData private constructor( } if (shouldPerformAutoSaveWheneverChanged()) { - owner_.launch(CoroutineName("AutoSavePluginData.timedAutoSave: ${this::class.qualifiedNameOrTip}")) { + authSaveJob = owner_.launch(CoroutineName("AutoSavePluginData.timedAutoSave: ${this::class.qualifiedNameOrTip}")) { while (isActive) { try { delay(autoSaveIntervalMillis_.last) // 定时自动保存一次, 用于 kts 序列化的对象 diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/LoggerControllerProvider.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/LoggerControllerProvider.kt new file mode 100644 index 000000000..ebe84d036 --- /dev/null +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/extensions/LoggerControllerProvider.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2019-2020 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + * + */ + +package net.mamoe.mirai.console.extensions + +import net.mamoe.mirai.console.extension.AbstractSingletonExtensionPoint +import net.mamoe.mirai.console.extension.SingletonExtension +import net.mamoe.mirai.console.internal.logging.LoggerControllerImpl +import net.mamoe.mirai.console.logging.LoggerController +import net.mamoe.mirai.console.permission.PermissionService + +public interface LoggerControllerProvider : SingletonExtension { + public companion object ExtensionPoint : + AbstractSingletonExtensionPoint(LoggerControllerProvider::class, LoggerControllerImpl) + +} + +/** + * @see LoggerControllerProvider + */ +public class LoggerControllerProviderImpl(override val instance: LoggerController) : LoggerControllerProvider + +/** + * @see LoggerControllerProvider + */ +public class LoggerControllerProviderLazy(initializer: () -> LoggerController) : LoggerControllerProvider { + override val instance: LoggerController by lazy(initializer) +} diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/MiraiConsoleImplementationBridge.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/MiraiConsoleImplementationBridge.kt index 00074b41f..cdde2d2f6 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/MiraiConsoleImplementationBridge.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/MiraiConsoleImplementationBridge.kt @@ -25,6 +25,7 @@ import net.mamoe.mirai.console.command.BuiltInCommands import net.mamoe.mirai.console.command.CommandManager import net.mamoe.mirai.console.command.ConsoleCommandSender import net.mamoe.mirai.console.data.PluginDataStorage +import net.mamoe.mirai.console.extensions.LoggerControllerProvider import net.mamoe.mirai.console.extensions.PermissionServiceProvider import net.mamoe.mirai.console.extensions.PostStartupExtension import net.mamoe.mirai.console.extensions.SingletonExtensionSelector @@ -35,12 +36,13 @@ import net.mamoe.mirai.console.internal.data.builtins.LoggerConfig import net.mamoe.mirai.console.internal.data.castOrNull import net.mamoe.mirai.console.internal.extension.BuiltInSingletonExtensionSelector import net.mamoe.mirai.console.internal.extension.GlobalComponentStorage +import net.mamoe.mirai.console.internal.logging.LoggerControllerDelegate import net.mamoe.mirai.console.internal.logging.LoggerControllerImpl +import net.mamoe.mirai.console.internal.logging.LoggerControllerTrusted import net.mamoe.mirai.console.internal.logging.MiraiConsoleLogger import net.mamoe.mirai.console.internal.permission.BuiltInPermissionService import net.mamoe.mirai.console.internal.plugin.PluginManagerImpl import net.mamoe.mirai.console.internal.util.autoHexToBytes -import net.mamoe.mirai.console.logging.LoggerController import net.mamoe.mirai.console.permission.PermissionService import net.mamoe.mirai.console.permission.PermissionService.Companion.permit import net.mamoe.mirai.console.permission.RootPermission @@ -86,8 +88,7 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI override val dataStorageForBuiltIns: PluginDataStorage by instance::dataStorageForBuiltIns override val configStorageForBuiltIns: PluginDataStorage by instance::configStorageForBuiltIns override val consoleInput: ConsoleInput by instance::consoleInput - override val loggerController: LoggerController by instance::loggerController - + private val loggerController = LoggerControllerDelegate(LoggerControllerTrusted) override fun createLoginSolver(requesterBot: Long, configuration: BotConfiguration): LoginSolver = instance.createLoginSolver(requesterBot, configuration) @@ -98,15 +99,16 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI override fun createLogger(identity: String?): MiraiLogger { val controller = loggerController - return MiraiConsoleLogger(controller, controller.newLogger(identity)) + return MiraiConsoleLogger(controller, instance.createLogger(identity)) } @Suppress("RemoveRedundantBackticks") internal fun doStart() { - phase `setup logger controller`@{ - if (loggerController is LoggerControllerImpl) { - ConsoleDataScope.addAndReloadConfig(LoggerConfig) - } + + phase `pre setup logger controller`@{ + loggerController.delegate = LoggerControllerImpl + // Relaod LoggerConfig first. + ConsoleDataScope.addAndReloadConfig(LoggerConfig) } phase `greeting`@{ @@ -175,6 +177,14 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI } } + phase `setup logger controller`@{ + val selected = LoggerControllerProvider.selectedInstance + if (selected !== LoggerControllerImpl) { + ConsoleDataScope.dropConfig(LoggerConfig) + loggerController.delegate = selected + } + } + phase `load PermissionService`@{ mainLogger.verbose { "Loading PermissionService..." } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/builtins/ConsoleDataScope.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/builtins/ConsoleDataScope.kt index 98b8077bd..95c0d9a8f 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/builtins/ConsoleDataScope.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/builtins/ConsoleDataScope.kt @@ -11,10 +11,7 @@ package net.mamoe.mirai.console.internal.data.builtins import kotlinx.coroutines.CoroutineScope import net.mamoe.mirai.console.MiraiConsole -import net.mamoe.mirai.console.data.AutoSavePluginDataHolder -import net.mamoe.mirai.console.data.PluginConfig -import net.mamoe.mirai.console.data.PluginData -import net.mamoe.mirai.console.data.PluginDataStorage +import net.mamoe.mirai.console.data.* import net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge import net.mamoe.mirai.console.util.CoroutineScopeUtils.childScope import net.mamoe.mirai.utils.minutesToMillis @@ -29,6 +26,11 @@ internal object ConsoleDataScope : CoroutineScope by MiraiConsole.childScope("Co ConsoleBuiltInPluginConfigStorage.load(ConsoleBuiltInPluginConfigHolder, config) } + fun dropConfig(config: PluginConfig) { + configs.remove(config) + (config as? AutoSavePluginConfig)?.destroy() + } + fun reloadAll() { data.forEach { dt -> ConsoleBuiltInPluginDataStorage.load(ConsoleBuiltInPluginDataHolder, dt) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/builtins/LoggerConfig.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/builtins/LoggerConfig.kt index a7fc11db2..394bc1d78 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/builtins/LoggerConfig.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/builtins/LoggerConfig.kt @@ -13,8 +13,7 @@ package net.mamoe.mirai.console.internal.data.builtins import net.mamoe.mirai.console.data.AutoSavePluginConfig import net.mamoe.mirai.console.data.ValueDescription import net.mamoe.mirai.console.data.value -import net.mamoe.mirai.utils.SimpleLogger -import java.util.* +import net.mamoe.mirai.console.logging.LogPriority internal object LoggerConfig : AutoSavePluginConfig("Logger") { @ValueDescription(""" @@ -29,30 +28,4 @@ internal object LoggerConfig : AutoSavePluginConfig("Logger") { mapOf("example.logger" to LogPriority.NONE) ) - enum class LogPriority { - ALL(null), - VERBOSE, - DEBUG, - INFO, - WARNING, - ERROR, - NONE(null); - - var mapped: SimpleLogger.LogPriority? = null - - // resolve NullPointerException - private object Holder { - @JvmField - val mapping = EnumMap(SimpleLogger.LogPriority::class.java) - } - companion object { - fun by(priority: SimpleLogger.LogPriority): LogPriority = Holder.mapping[priority]!! - } - constructor(void: Nothing?) - constructor() { - mapped = SimpleLogger.LogPriority.valueOf(name) - Holder.mapping[mapped] = this - } - - } } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerDelegate.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerDelegate.kt new file mode 100644 index 000000000..c10c32f2a --- /dev/null +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerDelegate.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2019-2020 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + * + */ + +package net.mamoe.mirai.console.internal.logging + +import net.mamoe.mirai.console.logging.LoggerController +import net.mamoe.mirai.utils.SimpleLogger + +internal class LoggerControllerDelegate( + @Volatile + var delegate: LoggerController +) : LoggerController { + override fun shouldLog(identity: String?, priority: SimpleLogger.LogPriority): Boolean = delegate.shouldLog(identity, priority) +} \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerImpl.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerImpl.kt index 925813cde..5984d5f03 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerImpl.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerImpl.kt @@ -12,20 +12,21 @@ package net.mamoe.mirai.console.internal.logging import net.mamoe.mirai.console.ConsoleFrontEndImplementation import net.mamoe.mirai.console.internal.data.builtins.LoggerConfig +import net.mamoe.mirai.console.logging.LogPriority import net.mamoe.mirai.console.logging.LoggerController import net.mamoe.mirai.console.util.ConsoleInternalApi import net.mamoe.mirai.utils.SimpleLogger @ConsoleFrontEndImplementation @ConsoleInternalApi -public abstract class LoggerControllerImpl : LoggerController { +internal object LoggerControllerImpl : LoggerController { private fun shouldLog( - priority: LoggerConfig.LogPriority, - settings: LoggerConfig.LogPriority + priority: LogPriority, + settings: LogPriority ): Boolean = settings <= priority - private fun shouldLog(identity: String?, priority: LoggerConfig.LogPriority): Boolean { + private fun shouldLog(identity: String?, priority: LogPriority): Boolean { return if (identity == null) { shouldLog(priority, LoggerConfig.defaultPriority) } else { @@ -34,6 +35,6 @@ public abstract class LoggerControllerImpl : LoggerController { } override fun shouldLog(identity: String?, priority: SimpleLogger.LogPriority): Boolean = - shouldLog(identity, LoggerConfig.LogPriority.by(priority)) + shouldLog(identity, LogPriority.by(priority)) } \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerTrusted.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerTrusted.kt new file mode 100644 index 000000000..eb2e16381 --- /dev/null +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerTrusted.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2019-2020 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + * + */ + +package net.mamoe.mirai.console.internal.logging + +import net.mamoe.mirai.console.logging.LoggerController +import net.mamoe.mirai.utils.SimpleLogger + +internal object LoggerControllerTrusted: LoggerController { + override fun shouldLog(identity: String?, priority: SimpleLogger.LogPriority): Boolean = true +} diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LogPriority.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LogPriority.kt new file mode 100644 index 000000000..957e42206 --- /dev/null +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LogPriority.kt @@ -0,0 +1,44 @@ +/* + * Copyright 2019-2020 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + * + */ + +package net.mamoe.mirai.console.logging + +import net.mamoe.mirai.utils.SimpleLogger +import java.util.* + +public enum class LogPriority { + ALL(null), + VERBOSE, + DEBUG, + INFO, + WARNING, + ERROR, + NONE(null); + + private var mapped: SimpleLogger.LogPriority? = null + + public companion object { + private val mapping = EnumMap(SimpleLogger.LogPriority::class.java) + + public fun by(priority: SimpleLogger.LogPriority): LogPriority = mapping[priority]!! + + init { + values().forEach { priority -> + mapping[priority.mapped ?: return@forEach] = priority + } + } + } + + constructor(void: Nothing?) + constructor() { + mapped = SimpleLogger.LogPriority.valueOf(name) + } + +} \ No newline at end of file diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerController.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerController.kt index ba120cb72..d4124e2fb 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerController.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerController.kt @@ -10,11 +10,8 @@ package net.mamoe.mirai.console.logging -import net.mamoe.mirai.console.ConsoleFrontEndImplementation -import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.internal.logging.LoggerControllerImpl import net.mamoe.mirai.console.util.ConsoleExperimentalApi -import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.SimpleLogger /** @@ -23,22 +20,8 @@ import net.mamoe.mirai.utils.SimpleLogger * @see [LoggerControllerImpl] */ @ConsoleExperimentalApi -@ConsoleFrontEndImplementation public interface LoggerController { /** 是否应该记录该等级的日志 */ public fun shouldLog(identity: String?, priority: SimpleLogger.LogPriority): Boolean - /** - * 创建一个新的 [MiraiLogger] - * - * 实现细节: - * - 应当直接创建一个新的 [MiraiLogger], 且不进行任何持久性操作, - * 例如 放置到字段, 放入任意集合 等 - * - 即不需要在此方法中把 [MiraiLogger] 放入任意缓存 - * - * * **注意**: [MiraiConsole] 会将 [net.mamoe.mirai.utils.DefaultLogger] 设置为 `MiraiConsole::createLogger`. - * `MiraiConsole::createLogger` 会使用 [LoggerController.newLogger] - * 因此不要在 [newLogger] 中调用 [net.mamoe.mirai.utils.DefaultLogger] - */ - public fun newLogger(identity: String?): MiraiLogger } diff --git a/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/TestMiraiConosle.kt b/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/TestMiraiConosle.kt index fd436a4b3..d5186fabe 100644 --- a/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/TestMiraiConosle.kt +++ b/backend/mirai-console/src/test/kotlin/net/mamoe/mirai/console/TestMiraiConosle.kt @@ -71,9 +71,8 @@ fun initTestEnvironment() { override fun createLoginSolver(requesterBot: Long, configuration: BotConfiguration): LoginSolver = LoginSolver.Default - override val loggerController: LoggerController = object : LoggerController { - override fun shouldLog(identity: String?, priority: SimpleLogger.LogPriority): Boolean = true - override fun newLogger(identity: String?): MiraiLogger = PlatformLogger(identity) + override fun createLogger(identity: String?): MiraiLogger { + return PlatformLogger(identity) } override val coroutineContext: CoroutineContext = SupervisorJob() + CoroutineExceptionHandler { _, throwable -> diff --git a/frontend/mirai-console-terminal/src/main/kotlin/net/mamoe/mirai/console/terminal/MiraiConsoleImplementationTerminal.kt b/frontend/mirai-console-terminal/src/main/kotlin/net/mamoe/mirai/console/terminal/MiraiConsoleImplementationTerminal.kt index 5917c096e..43252bf18 100644 --- a/frontend/mirai-console-terminal/src/main/kotlin/net/mamoe/mirai/console/terminal/MiraiConsoleImplementationTerminal.kt +++ b/frontend/mirai-console-terminal/src/main/kotlin/net/mamoe/mirai/console/terminal/MiraiConsoleImplementationTerminal.kt @@ -83,8 +83,8 @@ class MiraiConsoleImplementationTerminal return DefaultLoginSolver(input = { requestInput("LOGIN> ") }) } - override val loggerController: LoggerController = object : LoggerControllerImpl() { - override fun newLogger(identity: String?): MiraiLogger = LoggerCreator(identity) + override fun createLogger(identity: String?): MiraiLogger { + return LoggerCreator(identity) } init {