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

SimpleLogger

class SimpleLogger : MiraiLoggerPlatformBase

简易日志记录, 所有类型日志都会被重定向 logger

Types

LogPriority

enum class LogPriority

Constructors

<init>

简易日志记录, 所有类型日志都会被重定向 logger

SimpleLogger(identity: String?, logger: (priority: LogPriority, message: String?, e: Throwable?) -> Unit)

Properties

identity

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

val identity: String?

Functions

debug0

fun debug0(message: String?): Unit
fun debug0(message: String?, e: Throwable?): 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

Companion Object Functions

invoke

operator fun invoke(logger: (message: String?, e: Throwable?) -> Unit): SimpleLogger
operator fun invoke(identity: String?, logger: (message: String?, e: Throwable?) -> Unit): SimpleLogger
operator fun invoke(logger: (priority: LogPriority, message: String?, e: Throwable?) -> Unit): SimpleLogger

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