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)
}
- Companion:
- object
Value members
Abstract methods
Inherited methods
Combines this logger with the specified logger to produce a new logger that logs to both this logger and that logger.
Combines this logger with the specified logger to produce a new logger that logs to both this logger and that logger.
- Inherited from:
- ZLogger
Returns a version of this logger that only logs messages when the log level satisfies the specified predicate.
Returns a version of this logger that only logs messages when the log level satisfies the specified predicate.
- Inherited from:
- ZLogger