Remove use of deprecated MiraiLogger.TopLevel

This commit is contained in:
Him188 2021-11-06 14:44:58 +00:00
parent ad8cc21ee4
commit b45ca8df81
6 changed files with 11 additions and 8 deletions

View File

@ -171,7 +171,7 @@ public interface MiraiConsole : CoroutineScope {
redirectNetworkLogToDirectory()
this.botLoggerSupplier = {
MiraiLogger.create("Bot.${it.id}")
MiraiLogger.Factory.create(Bot::class, "Bot.${it.id}")
}
parentCoroutineContext = MiraiConsole.childScopeContext("Bot $id")
autoReconnectOnForceOffline()

View File

@ -119,7 +119,7 @@ public open class AutoSavePluginData private constructor(
}
internal val debuggingLogger1 by lazy {
MiraiLogger.create("console.debug").withSwitch(false)
MiraiLogger.Factory.create(AutoSavePluginData::class, "console.debug").withSwitch(false)
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")

View File

@ -33,7 +33,7 @@ import org.jline.reader.UserInterruptException
import kotlin.reflect.KClass
import kotlin.reflect.full.isSubclassOf
val consoleLogger by lazy { MiraiLogger.create("console") }
val consoleLogger by lazy { MiraiLogger.Factory.create(MiraiConsole::class, "console") }
@OptIn(ConsoleInternalApi::class, ConsoleTerminalExperimentalApi::class, ExperimentalCommandDescriptors::class)
internal fun startupConsoleThread() {

View File

@ -169,7 +169,8 @@ internal fun overrideSTD() {
System.setOut(
PrintStream(
BufferedOutputStream(
logger = MiraiLogger.create("stdout").run { ({ line: String? -> info(line) }) }
logger = MiraiLogger.Factory.create(MiraiConsoleTerminalLoader::class, "stdout")
.run { ({ line: String? -> info(line) }) }
),
false,
"UTF-8"
@ -178,7 +179,8 @@ internal fun overrideSTD() {
System.setErr(
PrintStream(
BufferedOutputStream(
logger = MiraiLogger.create("stderr").run { ({ line: String? -> warning(line) }) }
logger = MiraiLogger.Factory.create(MiraiConsoleTerminalLoader::class, "stderr")
.run { ({ line: String? -> warning(line) }) }
),
false,
"UTF-8"

View File

@ -10,6 +10,7 @@
package net.mamoe.mirai.console.terminal
import kotlinx.coroutines.runBlocking
import net.mamoe.mirai.Bot
import net.mamoe.mirai.console.MiraiConsole
import net.mamoe.mirai.console.extensions.BotConfigurationAlterer
import net.mamoe.mirai.console.logging.LoggerController
@ -34,7 +35,7 @@ fun main() {
BotConfigurationAlterer,
mockPlugin,
BotConfigurationAlterer { _, configuration ->
configuration.networkLoggerSupplier = { MiraiLogger.create("Net.${it.id}") } // deploy
configuration.networkLoggerSupplier = { MiraiLogger.Factory.create(Bot::class, "Net.${it.id}") } // deploy
configuration
}
)

View File

@ -10,6 +10,6 @@
package net.mamoe.mirai.console.gradle
internal object VersionConstants {
const val CONSOLE_VERSION = "2.8.0-M1" // value is written here automatically during build
const val CORE_VERSION = "2.8.0-M1" // value is written here automatically during build
const val CONSOLE_VERSION = "2.8.0" // value is written here automatically during build
const val CORE_VERSION = "2.8.0" // value is written here automatically during build
}