Fix MiraiConsoleLoggerUnused.isEnabled

This commit is contained in:
Karlatemp 2020-10-24 19:58:29 +08:00
parent e9de080a96
commit 1d88a9d942
No known key found for this signature in database
GPG Key ID: 21FBDDF664FF06F8
2 changed files with 3 additions and 6 deletions

View File

@ -112,6 +112,7 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI
ConsoleDataScope.addAndReloadConfig(LoggerConfig)
}
}
phase `greeting`@{
val buildDateFormatted =
buildDate.atZone(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
@ -120,6 +121,7 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI
mainLogger.info { "Backend: version $version, built on $buildDateFormatted." }
mainLogger.info { frontEndDescription.render() }
}
phase `check coroutineContext`@{
if (coroutineContext[Job] == null) {
throw MalformedMiraiConsoleImplementationError("The coroutineContext given to MiraiConsole must have a Job in it.")

View File

@ -45,17 +45,12 @@ internal class MiraiConsoleLoggerUnused(
delegateLogger.logger = logger
logger
}
override val isEnabled: Boolean
get() = super.isEnabled
override val isEnabled: Boolean get() = logger.isEnabled
override fun debug0(message: String?, e: Throwable?) = logger.debug(message, e)
override fun error0(message: String?, e: Throwable?) = logger.error(message, e)
override fun info0(message: String?, e: Throwable?) = logger.info(message, e)
override fun verbose0(message: String?, e: Throwable?) = logger.verbose(message, e)
override fun warning0(message: String?, e: Throwable?) = logger.warning(message, e)
}