zio.test.ZTestLogger
See theZTestLogger companion object
sealed trait ZTestLogger[-Message, +Output] extends ZLogger[Message, Output]
A ZTestLogger
is an implementation of a ZLogger
that writes all log messages to an internal data structure. The contents of this data structure can be accessed using the logOutput
operator. This makes it easy to write tests to verify that expected messages are being logged.
test("logging works") {
for {
_ <- ZIO.logDebug("It's alive!")
output <- ZTestLogger.logOutput
} yield assertTrue(output.length == 1) &&
assertTrue(output(0).message() == "It's alive!") &&
assertTrue(output(0).logLevel == LogLevel.Debug)
}
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
In this article