MiraiLoggerPlatformBase

日志基类. 若 Mirai 自带的日志系统无法满足需求, 请继承这个类或 PlatformLogger 并实现其抽象函数.

这个类不应该被用作变量的类型定义. 只应被作为继承对象. 在定义 logger 变量时, 请一直使用 MiraiLogger 或者 MiraiLoggerWithSwitch.

See also

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
expect open fun call(priority: SimpleLogger.LogPriority, message: String? = null, e: Throwable? = null)

根据优先级调用对应函数

Link copied to clipboard
expect open fun debug(e: Throwable?)
override fun debug(message: String?, e: Throwable?)

override fun debug(message: String?)

记录一个 调试 级别的日志.

Link copied to clipboard
inline fun MiraiLogger.debug(message: () -> String?)
inline fun MiraiLogger.debug(message: () -> String?, e: Throwable?)
Link copied to clipboard
expect open fun error(e: Throwable?)
override fun error(message: String?, e: Throwable?)

override fun error(message: String?)

记录一个 错误 级别的日志.

Link copied to clipboard
inline fun MiraiLogger.error(message: () -> String?)
inline fun MiraiLogger.error(message: () -> String?, e: Throwable?)
Link copied to clipboard
expect open fun info(e: Throwable?)
override fun info(message: String?, e: Throwable?)

override fun info(message: String?)

记录一个 信息 级别的日志.

Link copied to clipboard
inline fun MiraiLogger.info(message: () -> String?)
inline fun MiraiLogger.info(message: () -> String?, e: Throwable?)
Link copied to clipboard
expect open fun verbose(e: Throwable?)
override fun verbose(message: String?, e: Throwable?)

override fun verbose(message: String?)

记录一个 verbose 级别的日志. 无关紧要的, 经常大量输出的日志应使用它.

Link copied to clipboard
inline fun MiraiLogger.verbose(message: () -> String)
inline fun MiraiLogger.verbose(message: () -> String, e: Throwable?)
Link copied to clipboard
expect open fun warning(e: Throwable?)
override fun warning(message: String?, e: Throwable?)

override fun warning(message: String?)

记录一个 警告 级别的日志.

Link copied to clipboard
inline fun MiraiLogger.warning(message: () -> String?)
inline fun MiraiLogger.warning(message: () -> String?, e: Throwable?)
Link copied to clipboard

给这个 logger 添加一个开关, 用于控制是否记录 log

Properties

Link copied to clipboard
expect abstract val identity: String?

日志的标记. 在 Mirai 中, identity 可为

Link copied to clipboard
expect open val isDebugEnabled: Boolean

当 DEBUG 级别的日志启用时返回 true

Link copied to clipboard
open override val isEnabled: Boolean

获取 MiraiLogger 是否已开启

Link copied to clipboard
expect open val isErrorEnabled: Boolean

当 ERROR 级别的日志启用时返回 true

Link copied to clipboard
expect open val isInfoEnabled: Boolean

当 INFO 级别的日志启用时返回 true

Link copied to clipboard
expect open val isVerboseEnabled: Boolean

当 VERBOSE 级别的日志启用时返回 true.

Link copied to clipboard
expect open val isWarningEnabled: Boolean

当 WARNING 级别的日志启用时返回 true