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 9916f025c..3bee16ef3 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 @@ -19,7 +19,7 @@ import net.mamoe.mirai.console.command.ConsoleCommandSender import net.mamoe.mirai.console.data.PluginDataStorage import net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge import net.mamoe.mirai.console.logging.LoggerController -import net.mamoe.mirai.console.logging.LoggerControllerForFrontend +import net.mamoe.mirai.console.internal.logging.LoggerControllerImpl import net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader import net.mamoe.mirai.console.plugin.loader.PluginLoader import net.mamoe.mirai.console.util.ConsoleInput @@ -166,7 +166,7 @@ public interface MiraiConsoleImplementation : CoroutineScope { /** * 日志控制器 * - * @see [LoggerControllerForFrontend] + * @see [LoggerControllerImpl] */ public val loggerController: LoggerController 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 90024c888..00074b41f 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 @@ -35,11 +35,12 @@ 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.LoggerControllerImpl +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.* -import net.mamoe.mirai.console.internal.logging.MiraiConsoleLogger +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 @@ -103,7 +104,7 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI @Suppress("RemoveRedundantBackticks") internal fun doStart() { phase `setup logger controller`@{ - if (loggerController is LoggerControllerForFrontend) { + if (loggerController is LoggerControllerImpl) { ConsoleDataScope.addAndReloadConfig(LoggerConfig) } } diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerControllerForFrontend.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerImpl.kt similarity index 88% rename from backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerControllerForFrontend.kt rename to backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerImpl.kt index 89bd913ba..925813cde 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerControllerForFrontend.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/logging/LoggerControllerImpl.kt @@ -8,16 +8,17 @@ * */ -package net.mamoe.mirai.console.logging +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.LoggerController import net.mamoe.mirai.console.util.ConsoleInternalApi import net.mamoe.mirai.utils.SimpleLogger @ConsoleFrontEndImplementation @ConsoleInternalApi -public abstract class LoggerControllerForFrontend : LoggerControllerPlatformBase() { +public abstract class LoggerControllerImpl : LoggerController { private fun shouldLog( priority: LoggerConfig.LogPriority, 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 75b280e89..ba120cb72 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 @@ -12,22 +12,22 @@ 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 -import java.util.concurrent.atomic.AtomicReference /** * 日志控制系统 * - * @see [LoggerControllerPlatformBase] - * @see [LoggerControllerForFrontend] + * @see [LoggerControllerImpl] */ @ConsoleExperimentalApi @ConsoleFrontEndImplementation public interface LoggerController { /** 是否应该记录该等级的日志 */ public fun shouldLog(identity: String?, priority: SimpleLogger.LogPriority): Boolean + /** * 创建一个新的 [MiraiLogger] * diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerControllerPlatformBase.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerControllerPlatformBase.kt deleted file mode 100644 index 2be82ab8a..000000000 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/logging/LoggerControllerPlatformBase.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.console.ConsoleFrontEndImplementation -import net.mamoe.mirai.console.util.ConsoleExperimentalApi -import net.mamoe.mirai.utils.MiraiLogger -import net.mamoe.mirai.utils.SimpleLogger -import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.atomic.AtomicReference - -@Suppress("MemberVisibilityCanBePrivate") -@ConsoleExperimentalApi -@ConsoleFrontEndImplementation -public abstract class LoggerControllerPlatformBase : LoggerController { - - override fun shouldLog(identity: String?, priority: SimpleLogger.LogPriority): Boolean = true - -} \ No newline at end of file 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 ca770aeb5..fd436a4b3 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 @@ -15,7 +15,6 @@ import net.mamoe.mirai.console.command.CommandManager import net.mamoe.mirai.console.data.MemoryPluginDataStorage import net.mamoe.mirai.console.data.PluginDataStorage import net.mamoe.mirai.console.logging.LoggerController -import net.mamoe.mirai.console.logging.LoggerControllerPlatformBase import net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader import net.mamoe.mirai.console.plugin.loader.PluginLoader import net.mamoe.mirai.console.util.ConsoleExperimentalApi @@ -72,7 +71,7 @@ fun initTestEnvironment() { override fun createLoginSolver(requesterBot: Long, configuration: BotConfiguration): LoginSolver = LoginSolver.Default - override val loggerController: LoggerController = object : LoggerControllerPlatformBase() { + override val loggerController: LoggerController = object : LoggerController { override fun shouldLog(identity: String?, priority: SimpleLogger.LogPriority): Boolean = true override fun newLogger(identity: String?): MiraiLogger = PlatformLogger(identity) } 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 642e12e45..5917c096e 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 @@ -34,7 +34,7 @@ import net.mamoe.mirai.console.MiraiConsoleImplementation import net.mamoe.mirai.console.data.MultiFilePluginDataStorage import net.mamoe.mirai.console.data.PluginDataStorage import net.mamoe.mirai.console.logging.LoggerController -import net.mamoe.mirai.console.logging.LoggerControllerForFrontend +import net.mamoe.mirai.console.internal.logging.LoggerControllerImpl import net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader import net.mamoe.mirai.console.plugin.loader.PluginLoader import net.mamoe.mirai.console.terminal.ConsoleInputImpl.requestInput @@ -83,7 +83,7 @@ class MiraiConsoleImplementationTerminal return DefaultLoginSolver(input = { requestInput("LOGIN> ") }) } - override val loggerController: LoggerController = object : LoggerControllerForFrontend() { + override val loggerController: LoggerController = object : LoggerControllerImpl() { override fun newLogger(identity: String?): MiraiLogger = LoggerCreator(identity) }