org.jetbrains.dokka.testApi.logger.TestLogger.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dokka-test-api Show documentation
Show all versions of dokka-test-api Show documentation
Dokka is an API documentation engine for Kotlin
The newest version!
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package org.jetbrains.dokka.testApi.logger
import org.jetbrains.dokka.utilities.DokkaLogger
import java.util.*
/*
* Even in tests it be used in a concurrent environment, so needs to be thread safe
*/
public class TestLogger(private val logger: DokkaLogger) : DokkaLogger {
override var warningsCount: Int by logger::warningsCount
override var errorsCount: Int by logger::errorsCount
private var _debugMessages = synchronizedMutableListOf()
public val debugMessages: List get() = _debugMessages.toList()
private var _infoMessages = synchronizedMutableListOf()
public val infoMessages: List get() = _infoMessages.toList()
private var _progressMessages = synchronizedMutableListOf()
public val progressMessages: List get() = _progressMessages.toList()
private var _warnMessages = synchronizedMutableListOf()
public val warnMessages: List get() = _warnMessages.toList()
private var _errorMessages = synchronizedMutableListOf()
public val errorMessages: List get() = _errorMessages.toList()
override fun debug(message: String) {
_debugMessages.add(message)
logger.debug(message)
}
override fun info(message: String) {
_infoMessages.add(message)
logger.info(message)
}
override fun progress(message: String) {
_progressMessages.add(message)
logger.progress(message)
}
override fun warn(message: String) {
_warnMessages.add(message)
logger.warn(message)
}
override fun error(message: String) {
_errorMessages.add(message)
logger.error(message)
}
private fun synchronizedMutableListOf(): MutableList = Collections.synchronizedList(mutableListOf())
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy