mirai-core / net.mamoe.mirai.utils / MiraiLoggerWithSwitch

MiraiLoggerWithSwitch

class MiraiLoggerWithSwitch : MiraiLoggerPlatformBase

带有开关的 Logger. 仅能通过 MiraiLogger.withSwitch 构造

See Also

enable

disable

Properties

identity

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

val identity: String?

isEnabled

获取 MiraiLogger 是否已开启

val isEnabled: Boolean

Functions

debug0

fun debug0(message: String?): Unit
fun debug0(message: String?, e: Throwable?): Unit

disable

fun disable(): Unit

enable

fun enable(): Unit

error0

fun error0(message: String?): Unit
fun error0(message: String?, e: Throwable?): Unit

info0

fun info0(message: String?): Unit
fun info0(message: String?, e: Throwable?): Unit

verbose0

fun verbose0(message: String?): Unit
fun verbose0(message: String?, e: Throwable?): Unit

warning0

fun warning0(message: String?): Unit
fun warning0(message: String?, e: Throwable?): Unit

Extension Functions

debug

fun MiraiLogger.debug(lazyMessage: () -> String?): Unit
fun MiraiLogger.debug(lazyMessage: () -> String?, e: Throwable?): Unit

error

fun MiraiLogger.error(lazyMessage: () -> String?): Unit
fun MiraiLogger.error(lazyMessage: () -> String?, e: Throwable?): Unit

info

fun MiraiLogger.info(lazyMessage: () -> String?): Unit
fun MiraiLogger.info(lazyMessage: () -> String?, e: Throwable?): Unit

verbose

fun MiraiLogger.verbose(lazyMessage: () -> String): Unit
fun MiraiLogger.verbose(lazyMessage: () -> String, e: Throwable?): Unit

warning

fun MiraiLogger.warning(lazyMessage: () -> String?): Unit
fun MiraiLogger.warning(lazyMessage: () -> String?, e: Throwable?): Unit

withSwitch

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

fun MiraiLogger.withSwitch(default: Boolean = true): MiraiLoggerWithSwitch