mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-03 01:39:35 +08:00
Optimize internal event logs
This commit is contained in:
parent
f558537465
commit
b2b8e1206a
@ -487,12 +487,14 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
|
||||
) {
|
||||
// highest priority: pass to listeners (attached by sendAndExpect).
|
||||
if (packet != null && (bot.logger.isEnabled || logger.isEnabled)) {
|
||||
when (packet) {
|
||||
is Packet.NoLog -> {
|
||||
when {
|
||||
packet is Packet.NoLog -> {
|
||||
// nothing to do
|
||||
}
|
||||
is MessageEvent -> packet.logMessageReceived()
|
||||
is Event -> bot.logger.verbose { "Event: ${packet.toString().singleLine()}" }
|
||||
packet is MessageEvent -> packet.logMessageReceived()
|
||||
packet is Event && packet !is Packet.NoEventLog -> bot.logger.verbose {
|
||||
"Event: ${packet.toString().singleLine()}"
|
||||
}
|
||||
else -> logger.verbose { "Recv: ${packet.toString().singleLine()}" }
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ internal class ConfigPushSvc {
|
||||
) {
|
||||
override val canBeCached: Boolean get() = false
|
||||
|
||||
sealed class PushReqResponse : Packet, Event, AbstractEvent() {
|
||||
sealed class PushReqResponse : Packet, Event, AbstractEvent(), Packet.NoEventLog {
|
||||
class Success(
|
||||
val struct: PushReqJceStruct
|
||||
) : PushReqResponse() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.mamoe.mirai.qqandroid.network
|
||||
|
||||
import net.mamoe.mirai.event.Event
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
|
||||
/**
|
||||
@ -14,4 +15,9 @@ interface Packet {
|
||||
* 实现这个接口的包将不会被记录到日志中
|
||||
*/
|
||||
interface NoLog
|
||||
|
||||
/**
|
||||
* 实现这个接口的 [Event] 不会被作为事件记录到日志中
|
||||
*/
|
||||
interface NoEventLog
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user