mirror of
https://github.com/mamoe/mirai.git
synced 2026-08-22 14:13:32 +08:00
[core+console] Improve logging hierarchy: (#2196)
- always use factory API from mirai-core - Terminal is still overriding standard outputs - plugins are forbidden to override logging framework (this was allowed but not working before)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
@@ -7,6 +7,8 @@
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
package net.mamoe.mirai.utils.logging
|
||||
|
||||
import io.ktor.client.*
|
||||
@@ -20,18 +22,6 @@ import kotlin.test.assertFalse
|
||||
import kotlin.test.assertIs
|
||||
|
||||
internal class MiraiLog4JAdapterTest {
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@Test
|
||||
fun `services prevail than legacy overrides`() {
|
||||
MiraiLogger.setDefaultLoggerCreator {
|
||||
net.mamoe.mirai.utils.SimpleLogger("my logger") { _: String?, _: Throwable? -> }
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
assertIs<net.mamoe.mirai.internal.utils.Log4jLoggerAdapter>(MiraiLogger.Factory.create(this::class))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `using log4j`() {
|
||||
assertIs<MiraiLog4JFactory>(loadService(MiraiLogger.Factory::class))
|
||||
|
||||
Reference in New Issue
Block a user