mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-09 03:12:36 +08:00
Remove use of deprecated MiraiLogger.TopLevel
This commit is contained in:
parent
bb9c9d7aa4
commit
e3dcaf6654
@ -52,7 +52,7 @@ internal class Handler<in E : Event> internal constructor(
|
|||||||
subscriberContext[CoroutineExceptionHandler]?.handleException(subscriberContext, e)
|
subscriberContext[CoroutineExceptionHandler]?.handleException(subscriberContext, e)
|
||||||
?: currentCoroutineContext()[CoroutineExceptionHandler]?.handleException(subscriberContext, e)
|
?: currentCoroutineContext()[CoroutineExceptionHandler]?.handleException(subscriberContext, e)
|
||||||
?: kotlin.run {
|
?: kotlin.run {
|
||||||
val logger = if (event is BotEvent) event.bot.logger else MiraiLogger.TopLevel
|
val logger = if (event is BotEvent) event.bot.logger else logger
|
||||||
val subscriberName = subscriberContext[CoroutineName]?.name ?: "<unnamed>"
|
val subscriberName = subscriberContext[CoroutineName]?.name ?: "<unnamed>"
|
||||||
val broadcasterName = currentCoroutineContext()[CoroutineName]?.name ?: "<unnamed>"
|
val broadcasterName = currentCoroutineContext()[CoroutineName]?.name ?: "<unnamed>"
|
||||||
val message =
|
val message =
|
||||||
@ -68,6 +68,12 @@ internal class Handler<in E : Event> internal constructor(
|
|||||||
ListeningStatus.LISTENING
|
ListeningStatus.LISTENING
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val logger by lazy {
|
||||||
|
MiraiLogger.Factory.create(Handler::class)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ListenerRegistry(
|
internal class ListenerRegistry(
|
||||||
|
@ -20,11 +20,15 @@ internal val SeleniumLoginSolver: LoginSolver? by lazy {
|
|||||||
} catch (ignore: ClassNotFoundException) {
|
} catch (ignore: ClassNotFoundException) {
|
||||||
null
|
null
|
||||||
} catch (error: Throwable) {
|
} catch (error: Throwable) {
|
||||||
MiraiLogger.TopLevel.warning("Error in loading mirai-login-solver-selenium, skip", error)
|
logger.warning("Error in loading mirai-login-solver-selenium, skip", error)
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val logger by lazy {
|
||||||
|
MiraiLogger.Factory.create(LoginSolver::class)
|
||||||
|
}
|
||||||
|
|
||||||
// null -> 该情况为 user 确认能自己传入 ticket, 不需要 Selenium 的帮助
|
// null -> 该情况为 user 确认能自己传入 ticket, 不需要 Selenium 的帮助
|
||||||
// true -> SeleniumLoginSolver 支持
|
// true -> SeleniumLoginSolver 支持
|
||||||
// false-> 无法提供默认滑块验证解决器
|
// false-> 无法提供默认滑块验证解决器
|
||||||
|
@ -637,7 +637,11 @@ public inline fun BotConfiguration(block: BotConfiguration.() -> Unit): BotConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal val deviceInfoStub: (Bot) -> DeviceInfo = {
|
internal val deviceInfoStub: (Bot) -> DeviceInfo = {
|
||||||
MiraiLogger.TopLevel.warning("未指定设备信息, 已使用随机设备信息. 请查看 BotConfiguration.deviceInfo 以获取更多信息.")
|
logger.warning("未指定设备信息, 已使用随机设备信息. 请查看 BotConfiguration.deviceInfo 以获取更多信息.")
|
||||||
MiraiLogger.TopLevel.warning("Device info isn't specified. Please refer to BotConfiguration.deviceInfo for more information")
|
logger.warning("Device info isn't specified. Please refer to BotConfiguration.deviceInfo for more information")
|
||||||
DeviceInfo.random()
|
DeviceInfo.random()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val logger by lazy {
|
||||||
|
MiraiLogger.Factory.create(BotConfiguration::class)
|
||||||
|
}
|
@ -144,12 +144,12 @@ internal object WindowHelperJvm {
|
|||||||
Toolkit.getDefaultToolkit()
|
Toolkit.getDefaultToolkit()
|
||||||
|
|
||||||
if (Desktop.isDesktopSupported()) {
|
if (Desktop.isDesktopSupported()) {
|
||||||
MiraiLogger.TopLevel.info(
|
logger.info(
|
||||||
"""
|
"""
|
||||||
Mirai 正在使用桌面环境. 如遇到验证码将会弹出对话框. 可添加 JVM 属性 `mirai.no-desktop` 以关闭.
|
Mirai 正在使用桌面环境. 如遇到验证码将会弹出对话框. 可添加 JVM 属性 `mirai.no-desktop` 以关闭.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
)
|
)
|
||||||
MiraiLogger.TopLevel.info(
|
logger.info(
|
||||||
"""
|
"""
|
||||||
Mirai is using desktop. Captcha will be thrown by window popup. You can add `mirai.no-desktop` to JVM properties (-Dmirai.no-desktop) to disable it.
|
Mirai is using desktop. Captcha will be thrown by window popup. You can add `mirai.no-desktop` to JVM properties (-Dmirai.no-desktop) to disable it.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
@ -162,6 +162,8 @@ internal object WindowHelperJvm {
|
|||||||
return@run PlatformKind.CLI
|
return@run PlatformKind.CLI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val logger by lazy { MiraiLogger.Factory.create(this::class) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user