mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-27 00:30:17 +08:00
Adjust loggers
This commit is contained in:
parent
e51c3ac4af
commit
b00b3d97f0
@ -26,7 +26,7 @@ internal object PluginManagerImpl : PluginManager {
|
|||||||
@Suppress("ObjectPropertyName")
|
@Suppress("ObjectPropertyName")
|
||||||
private val _pluginLoaders: MutableList<PluginLoader<*, *>> = mutableListOf()
|
private val _pluginLoaders: MutableList<PluginLoader<*, *>> = mutableListOf()
|
||||||
private val loadersLock: ReentrantLock = ReentrantLock()
|
private val loadersLock: ReentrantLock = ReentrantLock()
|
||||||
private val logger = MiraiConsole.newLogger("PluginManager")
|
private val logger = MiraiConsole.newLogger("plugin")
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
internal val resolvedPlugins: MutableList<Plugin> = mutableListOf()
|
internal val resolvedPlugins: MutableList<Plugin> = mutableListOf()
|
||||||
|
@ -47,7 +47,7 @@ internal fun startupConsoleThread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoroutineScope(dispatch).launch {
|
CoroutineScope(dispatch).launch {
|
||||||
val consoleLogger = DefaultLogger("Console")
|
val consoleLogger = DefaultLogger("console")
|
||||||
while (isActive) {
|
while (isActive) {
|
||||||
try {
|
try {
|
||||||
val next = MiraiConsoleFrontEndPure.requestInput("").let {
|
val next = MiraiConsoleFrontEndPure.requestInput("").let {
|
||||||
@ -62,7 +62,7 @@ internal fun startupConsoleThread() {
|
|||||||
if (next.isBlank()) {
|
if (next.isBlank()) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
consoleLogger.debug("INPUT> $next")
|
// consoleLogger.debug("INPUT> $next")
|
||||||
val result = ConsoleCommandSenderImpl.executeCommandDetailed(next)
|
val result = ConsoleCommandSenderImpl.executeCommandDetailed(next)
|
||||||
when (result.status) {
|
when (result.status) {
|
||||||
CommandExecuteStatus.SUCCESSFUL -> {
|
CommandExecuteStatus.SUCCESSFUL -> {
|
||||||
|
@ -20,21 +20,13 @@
|
|||||||
|
|
||||||
package net.mamoe.mirai.console.pure
|
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.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.command.ConsoleCommandSender
|
||||||
import net.mamoe.mirai.console.util.ConsoleInternalAPI
|
import net.mamoe.mirai.console.util.ConsoleInternalAPI
|
||||||
import net.mamoe.mirai.message.data.Message
|
import net.mamoe.mirai.message.data.Message
|
||||||
import net.mamoe.mirai.message.data.content
|
import net.mamoe.mirai.message.data.content
|
||||||
import net.mamoe.mirai.utils.DefaultLogger
|
import net.mamoe.mirai.utils.DefaultLogger
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
import kotlin.concurrent.thread
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mirai-console-pure CLI 入口点
|
* mirai-console-pure CLI 入口点
|
||||||
@ -58,14 +50,14 @@ internal fun overrideSTD() {
|
|||||||
System.setOut(
|
System.setOut(
|
||||||
PrintStream(
|
PrintStream(
|
||||||
BufferedOutputStream(
|
BufferedOutputStream(
|
||||||
logger = DefaultLogger("sout").run { ({ line: String? -> info(line) }) }
|
logger = DefaultLogger("stdout").run { ({ line: String? -> info(line) }) }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
System.setErr(
|
System.setErr(
|
||||||
PrintStream(
|
PrintStream(
|
||||||
BufferedOutputStream(
|
BufferedOutputStream(
|
||||||
logger = DefaultLogger("serr").run { ({ line: String? -> warning(line) }) }
|
logger = DefaultLogger("stderr").run { ({ line: String? -> warning(line) }) }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user