Modifier and Type | Method and Description |
---|---|
static void |
disableCapture()
Disable capturing, forgetting about the logger set via
enableCaptureWith(Logger) . |
static void |
enableCaptureWith(Logger testLogger)
Set the logger used for capturing.
|
static void |
enableCaptureWith(Logger testLogger,
boolean redirectToOriginal)
Set the logger used for capturing, an optionally suppress log messages from original logger.
|
static Disposable |
useCurrentLoggersWithCapture()
Sets a
logger factory that will return loggers that not only use the
original logging framework used by reactor, but also use the logger set via enableCaptureWith(Logger) , irrespective
of its name or how it was obtained. |
public static Disposable useCurrentLoggersWithCapture() throws IllegalStateException
logger factory
that will return loggers that not only use the
original logging framework used by reactor, but also use the logger set via enableCaptureWith(Logger)
, irrespective
of its name or how it was obtained. The expectation here is that tests that want to assess that something is
logged by reactor will pass a TestLogger
instance to enableCaptureWith(Logger)
, trigger the operation
under scrutiny, assert the logger contents and reset state by calling disableCapture()
.
This method should be called very early in the application/tests lifecycle, before reactor classes have created their loggers.
IllegalStateException
public static void enableCaptureWith(Logger testLogger)
testLogger
- the Logger
in which to copy logsIllegalStateException
- if no capturing factory is installed or a previous logger has been set but not
cleared via disableCapture()
public static void enableCaptureWith(Logger testLogger, boolean redirectToOriginal)
testLogger
- the TestLogger
in which to copy or redirect logsredirectToOriginal
- whether log messages should also go to the original logging infrastructureIllegalStateException
- if no capturing factory is installed or a previous logger has been set but not
cleared via disableCapture()
public static void disableCapture()
enableCaptureWith(Logger)
.