Adjust loggers

This commit is contained in:
Him188 2020-08-20 20:49:27 +08:00
parent e51c3ac4af
commit b00b3d97f0
3 changed files with 5 additions and 13 deletions

View File

@ -26,7 +26,7 @@ internal object PluginManagerImpl : PluginManager {
@Suppress("ObjectPropertyName")
private val _pluginLoaders: MutableList<PluginLoader<*, *>> = mutableListOf()
private val loadersLock: ReentrantLock = ReentrantLock()
private val logger = MiraiConsole.newLogger("PluginManager")
private val logger = MiraiConsole.newLogger("plugin")
@JvmField
internal val resolvedPlugins: MutableList<Plugin> = mutableListOf()

View File

@ -47,7 +47,7 @@ internal fun startupConsoleThread() {
}
CoroutineScope(dispatch).launch {
val consoleLogger = DefaultLogger("Console")
val consoleLogger = DefaultLogger("console")
while (isActive) {
try {
val next = MiraiConsoleFrontEndPure.requestInput("").let {
@ -62,7 +62,7 @@ internal fun startupConsoleThread() {
if (next.isBlank()) {
continue
}
consoleLogger.debug("INPUT> $next")
// consoleLogger.debug("INPUT> $next")
val result = ConsoleCommandSenderImpl.executeCommandDetailed(next)
when (result.status) {
CommandExecuteStatus.SUCCESSFUL -> {

View File

@ -20,21 +20,13 @@
package net.mamoe.mirai.console.pure
import kotlinx.coroutines.isActive
import net.mamoe.mirai.console.MiraiConsole
import net.mamoe.mirai.console.MiraiConsoleImplementation.Companion.start
import net.mamoe.mirai.console.command.BuiltInCommands
import net.mamoe.mirai.console.command.Command.Companion.primaryName
import net.mamoe.mirai.console.command.CommandExecuteStatus
import net.mamoe.mirai.console.command.CommandManager
import net.mamoe.mirai.console.command.CommandManager.INSTANCE.executeCommandDetailed
import net.mamoe.mirai.console.command.ConsoleCommandSender
import net.mamoe.mirai.console.util.ConsoleInternalAPI
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.content
import net.mamoe.mirai.utils.DefaultLogger
import java.io.PrintStream
import kotlin.concurrent.thread
/**
* mirai-console-pure CLI 入口点
@ -58,14 +50,14 @@ internal fun overrideSTD() {
System.setOut(
PrintStream(
BufferedOutputStream(
logger = DefaultLogger("sout").run { ({ line: String? -> info(line) }) }
logger = DefaultLogger("stdout").run { ({ line: String? -> info(line) }) }
)
)
)
System.setErr(
PrintStream(
BufferedOutputStream(
logger = DefaultLogger("serr").run { ({ line: String? -> warning(line) }) }
logger = DefaultLogger("stderr").run { ({ line: String? -> warning(line) }) }
)
)
)