MiraiLogger

expect interface MiraiLogger

日志记录器.

Mirai 日志系统

Mirai 内建简单的日志系统, 即 MiraiLogger. MiraiLogger 的实现有 SimpleLogger, PlatformLogger, SilentLogger.

实现或使用 MiraiLogger

不建议实现或使用 MiraiLogger. 请优先考虑使用上述第三方框架. MiraiLogger 仅应用于兼容旧版本代码.

actual interface MiraiLogger

日志记录器.

Mirai 日志系统

Mirai 内建简单的日志系统, 即 MiraiLogger. MiraiLogger 的实现有 SimpleLogger, PlatformLogger, SilentLogger.

MiraiLogger 仅能处理简单的日志任务, 通常推荐使用 org.slf4j.Logger, org.apache.logging.log4j.Logger 等日志库.

使用第三方日志库接管 Mirai 日志系统

使用 LoggerAdapters, 将第三方日志 Logger 转为 MiraiLogger. 然后通过 MiraiLogger.Factory 提供实现.

实现或使用 MiraiLogger

不建议实现或使用 MiraiLogger. 请优先考虑使用上述第三方框架. MiraiLogger 仅应用于兼容旧版本代码.

actual interface MiraiLogger

日志记录器.

Mirai 日志系统

Mirai 内建简单的日志系统, 即 MiraiLogger. MiraiLogger 的实现有 SimpleLogger, PlatformLogger, SilentLogger.

实现或使用 MiraiLogger

不建议实现或使用 MiraiLogger. 请优先考虑使用上述第三方框架. MiraiLogger 仅应用于兼容旧版本代码.

See also

简易 logger, 它将所有的日志记录操作都转移给 lambda (String?, Throwable?) -> Unit

各个平台下的默认日志记录实现.

忽略任何日志记录操作的 logger 实例.

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

简易 logger, 它将所有的日志记录操作都转移给 lambda (String?, Throwable?) -> Unit

各个平台下的默认日志记录实现.

忽略任何日志记录操作的 logger 实例.

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

简易 logger, 它将所有的日志记录操作都转移给 lambda (String?, Throwable?) -> Unit

各个平台下的默认日志记录实现.

忽略任何日志记录操作的 logger 实例.

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

Types

Link copied to clipboard
expect object Companion
actual object Companion
actual object Companion
Link copied to clipboard
expect interface Factory

可以 service 实现的方式覆盖.

actual interface Factory

可以 service 实现的方式覆盖.

actual interface Factory

可以 service 实现的方式覆盖.

Functions

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

根据优先级调用对应函数

actual open fun call(    priority: SimpleLogger.LogPriority,     message: String?,     e: Throwable?)

根据优先级调用对应函数

actual open fun call(    priority: SimpleLogger.LogPriority,     message: String?,     e: Throwable?)

根据优先级调用对应函数

Link copied to clipboard
expect abstract fun debug(message: String?)

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

expect open fun debug(e: Throwable?)
expect abstract fun debug(message: String?, e: Throwable?)
actual abstract fun debug(message: String?)

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

actual open fun debug(e: Throwable?)
actual abstract fun debug(message: String?, e: Throwable?)
actual abstract fun debug(message: String?)

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

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

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

expect open fun error(e: Throwable?)
expect abstract fun error(message: String?, e: Throwable?)
actual abstract fun error(message: String?)

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

actual open fun error(e: Throwable?)
actual abstract fun error(message: String?, e: Throwable?)
actual abstract fun error(message: String?)

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

actual open fun error(e: Throwable?)
actual abstract fun error(message: String?, e: Throwable?)
Link copied to clipboard
expect abstract fun info(message: String?)

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

expect open fun info(e: Throwable?)
expect abstract fun info(message: String?, e: Throwable?)
actual abstract fun info(message: String?)

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

actual open fun info(e: Throwable?)
actual abstract fun info(message: String?, e: Throwable?)
actual abstract fun info(message: String?)

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

actual open fun info(e: Throwable?)
actual abstract fun info(message: String?, e: Throwable?)
Link copied to clipboard
expect abstract fun verbose(message: String?)

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

expect open fun verbose(e: Throwable?)
expect abstract fun verbose(message: String?, e: Throwable?)
actual abstract fun verbose(message: String?)

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

actual open fun verbose(e: Throwable?)
actual abstract fun verbose(message: String?, e: Throwable?)
actual abstract fun verbose(message: String?)

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

actual open fun verbose(e: Throwable?)
actual abstract fun verbose(message: String?, e: Throwable?)
Link copied to clipboard
expect abstract fun warning(message: String?)

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

expect open fun warning(e: Throwable?)
expect abstract fun warning(message: String?, e: Throwable?)
actual abstract fun warning(message: String?)

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

actual open fun warning(e: Throwable?)
actual abstract fun warning(message: String?, e: Throwable?)
actual abstract fun warning(message: String?)

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

actual open fun warning(e: Throwable?)
actual abstract fun warning(message: String?, e: Throwable?)

Properties

Link copied to clipboard
expect abstract val identity: String?

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

actual abstract val identity: String?

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

actual abstract val identity: String?

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

Link copied to clipboard
expect open val isDebugEnabled: Boolean

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

actual open val isDebugEnabled: Boolean

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

actual open val isDebugEnabled: Boolean

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

Link copied to clipboard
expect abstract val isEnabled: Boolean

获取 MiraiLogger 是否已开启

actual abstract val isEnabled: Boolean

获取 MiraiLogger 是否已开启

actual abstract val isEnabled: Boolean

获取 MiraiLogger 是否已开启

Link copied to clipboard
expect open val isErrorEnabled: Boolean

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

actual open val isErrorEnabled: Boolean

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

actual open val isErrorEnabled: Boolean

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

Link copied to clipboard
expect open val isInfoEnabled: Boolean

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

actual open val isInfoEnabled: Boolean

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

actual open val isInfoEnabled: Boolean

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

Link copied to clipboard
expect open val isVerboseEnabled: Boolean

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

actual open val isVerboseEnabled: Boolean

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

actual open val isVerboseEnabled: Boolean

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

Link copied to clipboard
expect open val isWarningEnabled: Boolean

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

actual open val isWarningEnabled: Boolean

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

actual open val isWarningEnabled: Boolean

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

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
inline fun MiraiLogger.debug(message: () -> String?)
inline fun MiraiLogger.debug(message: () -> String?, e: Throwable?)
Link copied to clipboard
inline fun MiraiLogger.error(message: () -> String?)
inline fun MiraiLogger.error(message: () -> String?, e: Throwable?)
Link copied to clipboard
inline fun MiraiLogger.info(message: () -> String?)
inline fun MiraiLogger.info(message: () -> String?, e: Throwable?)
Link copied to clipboard
inline fun MiraiLogger.verbose(message: () -> String)
inline fun MiraiLogger.verbose(message: () -> String, e: Throwable?)
Link copied to clipboard
inline fun MiraiLogger.warning(message: () -> String?)
inline fun MiraiLogger.warning(message: () -> String?, e: Throwable?)
Link copied to clipboard
fun MiraiLogger.withSwitch(default: Boolean = true): MiraiLoggerWithSwitch

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