Skip to content

Commit

Permalink
pref(core): 简单优化Bot日志相关以及添加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Jun 23, 2024
1 parent dfd5cc4 commit 73739c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ import kotlin.jvm.JvmSynthetic
* 且在重新连接的过程中始终失败并达到了重试次数上限,此时会话中的任务会被视为因异常结束,
* 并连带 [OneBotBot] 的任务一同终结。
*
* ### 日志
*
* [OneBotBot] 的内部会输出三种日志:
* - `love.forte.simbot.component.onebot.v11.core.bot.OneBotBot.$uniqueId`
* bot的基本日志,例如连接信息、接收到的原始事件等debug日志。
*
* @author ForteScarlet
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,19 @@ internal class OneBotBotImpl(
private val eventProcessor: EventProcessor,
baseDecoderJson: Json,
) : OneBotBot, JobBasedBot() {
companion object {
private const val BASE_LOGGER_NAME =
"love.forte.simbot.component.onebot.v11.core.bot.OneBotBot"
}

override val subContext = coroutineContext.minusKey(Job)
override val decoderJson: Json = Json(baseDecoderJson) {
configuration.serializersModule?.also { confMd ->
serializersModule = serializersModule overwriteWith confMd
}
}

internal val logger = LoggerFactory
.getLogger(
"love.forte.simbot.component.onebot.v11.core.bot.OneBotBot.$uniqueId"
)
internal val logger = LoggerFactory.getLogger("$BASE_LOGGER_NAME.$uniqueId")

private val eventServerHost = configuration.eventServerHost
private val connectMaxRetryTimes = configuration.wsConnectMaxRetryTimes
Expand Down

0 comments on commit 73739c6

Please sign in to comment.