mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-18 09:32:23 +08:00
Rename lazyMessage
to message
in MiraiLogger extensions.
https://github.com/mamoe/mirai/issues/630#issuecomment-703645344
This commit is contained in:
parent
2d8c01ba8b
commit
9cbdc858e7
@ -14,6 +14,8 @@
|
|||||||
package net.mamoe.mirai.utils
|
package net.mamoe.mirai.utils
|
||||||
|
|
||||||
import net.mamoe.mirai.Bot
|
import net.mamoe.mirai.Bot
|
||||||
|
import kotlin.contracts.InvocationKind.AT_MOST_ONCE
|
||||||
|
import kotlin.contracts.contract
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,44 +165,54 @@ public interface MiraiLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public inline fun MiraiLogger.verbose(lazyMessage: () -> String) {
|
public inline fun MiraiLogger.verbose(message: () -> String) {
|
||||||
if (isEnabled) verbose(lazyMessage())
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) verbose(message())
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.verbose(lazyMessage: () -> String, e: Throwable?) {
|
public inline fun MiraiLogger.verbose(message: () -> String, e: Throwable?) {
|
||||||
if (isEnabled) verbose(lazyMessage(), e)
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) verbose(message(), e)
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.debug(lazyMessage: () -> String?) {
|
public inline fun MiraiLogger.debug(message: () -> String?) {
|
||||||
if (isEnabled) debug(lazyMessage())
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) debug(message())
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.debug(lazyMessage: () -> String?, e: Throwable?) {
|
public inline fun MiraiLogger.debug(message: () -> String?, e: Throwable?) {
|
||||||
if (isEnabled) debug(lazyMessage(), e)
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) debug(message(), e)
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.info(lazyMessage: () -> String?) {
|
public inline fun MiraiLogger.info(message: () -> String?) {
|
||||||
if (isEnabled) info(lazyMessage())
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) info(message())
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.info(lazyMessage: () -> String?, e: Throwable?) {
|
public inline fun MiraiLogger.info(message: () -> String?, e: Throwable?) {
|
||||||
if (isEnabled) info(lazyMessage(), e)
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) info(message(), e)
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.warning(lazyMessage: () -> String?) {
|
public inline fun MiraiLogger.warning(message: () -> String?) {
|
||||||
if (isEnabled) warning(lazyMessage())
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) warning(message())
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.warning(lazyMessage: () -> String?, e: Throwable?) {
|
public inline fun MiraiLogger.warning(message: () -> String?, e: Throwable?) {
|
||||||
if (isEnabled) warning(lazyMessage(), e)
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) warning(message(), e)
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.error(lazyMessage: () -> String?) {
|
public inline fun MiraiLogger.error(message: () -> String?) {
|
||||||
if (isEnabled) error(lazyMessage())
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) error(message())
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun MiraiLogger.error(lazyMessage: () -> String?, e: Throwable?) {
|
public inline fun MiraiLogger.error(message: () -> String?, e: Throwable?) {
|
||||||
if (isEnabled) error(lazyMessage(), e)
|
contract { callsInPlace(message, AT_MOST_ONCE) }
|
||||||
|
if (isEnabled) error(message(), e)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user