diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-07-08 16:47:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 16:47:11 +0200 |
commit | 0cdb6d4de754ef5381de09be55ebdafa6868caca (patch) | |
tree | d3d742e66df4776ffd3aeb584b3b57d5709a3130 /plugins/base/src | |
parent | 393491918eb31fd1896c747e636965f917754b1b (diff) | |
download | dokka-0cdb6d4de754ef5381de09be55ebdafa6868caca.tar.gz dokka-0cdb6d4de754ef5381de09be55ebdafa6868caca.tar.bz2 dokka-0cdb6d4de754ef5381de09be55ebdafa6868caca.zip |
Ignore messages emitted by the IntelliJ Logger (#2563)
Diffstat (limited to 'plugins/base/src')
-rw-r--r-- | plugins/base/src/main/kotlin/DokkaBase.kt | 9 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/utils/NoopIntellijLogger.kt | 43 |
2 files changed, 52 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index 0443b136..377470d1 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -34,6 +34,7 @@ import org.jetbrains.dokka.base.transformers.pages.tags.SinceKotlinTagContentPro import org.jetbrains.dokka.base.translators.descriptors.DefaultExternalDocumentablesProvider import org.jetbrains.dokka.base.translators.descriptors.ExternalClasslikesTranslator import org.jetbrains.dokka.base.translators.descriptors.ExternalDocumentablesProvider +import org.jetbrains.dokka.base.utils.NoopIntellijLoggerFactory import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer import org.jetbrains.dokka.transformers.pages.PageTransformer @@ -272,4 +273,12 @@ class DokkaBase : DokkaPlugin() { val defaultExternalClasslikesTranslator by extending { externalClasslikesTranslator providing ::DefaultDescriptorToDocumentableTranslator } + + private companion object { + init { + // Suppress messages emitted by the IntelliJ logger since + // there's not much the end user can do about it + com.intellij.openapi.diagnostic.Logger.setFactory(NoopIntellijLoggerFactory()) + } + } } diff --git a/plugins/base/src/main/kotlin/utils/NoopIntellijLogger.kt b/plugins/base/src/main/kotlin/utils/NoopIntellijLogger.kt new file mode 100644 index 00000000..9248f996 --- /dev/null +++ b/plugins/base/src/main/kotlin/utils/NoopIntellijLogger.kt @@ -0,0 +1,43 @@ +package org.jetbrains.dokka.base.utils + +import com.intellij.openapi.diagnostic.Attachment +import com.intellij.openapi.diagnostic.DefaultLogger +import com.intellij.openapi.diagnostic.Logger + +internal class NoopIntellijLoggerFactory : Logger.Factory { + override fun getLoggerInstance(p0: String): Logger = NoopIntellijLogger +} + +/** + * Ignores all messages passed to it + */ +internal object NoopIntellijLogger : DefaultLogger(null) { + override fun isDebugEnabled(): Boolean = false + override fun isTraceEnabled(): Boolean = false + + override fun debug(message: String?) {} + override fun debug(t: Throwable?) {} + override fun debug(message: String?, t: Throwable?) {} + override fun debug(message: String, vararg details: Any?) {} + override fun debugValues(header: String, values: MutableCollection<*>) {} + + override fun trace(message: String?) {} + override fun trace(t: Throwable?) {} + + override fun info(message: String?) {} + override fun info(message: String?, t: Throwable?) {} + override fun info(t: Throwable) {} + + override fun warn(message: String?, t: Throwable?) {} + override fun warn(message: String?) {} + override fun warn(t: Throwable) {} + + override fun error(message: String?, t: Throwable?, vararg details: String?) {} + override fun error(message: String?) {} + override fun error(message: Any?) {} + override fun error(message: String?, vararg attachments: Attachment?) {} + override fun error(message: String?, t: Throwable?, vararg attachments: Attachment?) {} + override fun error(message: String?, vararg details: String?) {} + override fun error(message: String?, t: Throwable?) {} + override fun error(t: Throwable) {} +} |