All Downloads are FREE. Search and download functionalities are using the official Maven repository.

name.remal.gradle_plugins.dsl.extensions.org.gradle.api.logging.LoggingManager.kt Maven / Gradle / Ivy

There is a newer version: 1.9.2
Show newest version
package name.remal.gradle_plugins.dsl.extensions

import org.gradle.api.logging.LogLevel
import org.gradle.api.logging.LogLevel.ERROR
import org.gradle.api.logging.LogLevel.LIFECYCLE
import org.gradle.api.logging.LoggingManager

inline fun  LoggingManager.withCapturedStandardOutput(outputLevel: LogLevel = LIFECYCLE, errorLevel: LogLevel = ERROR, action: () -> R): R {
    val prevOutputLevel = standardOutputCaptureLevel
    val prevErrorLevel = standardErrorCaptureLevel
    try {
        captureStandardOutput(outputLevel)
        captureStandardError(errorLevel)

        return action()

    } finally {
        captureStandardOutput(prevOutputLevel)
        captureStandardError(prevErrorLevel)
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy