@@ -167,7 +167,7 @@ public void fatal(Object message, @Nullable Throwable t) {
167
167
private void log (LogLevel level , Object message , @ Nullable Throwable t ) {
168
168
synchronized (this .lines ) {
169
169
if (this .destination != null ) {
170
- logTo (this .destination , level , message , t );
170
+ level . log (this .destination , message , t );
171
171
}
172
172
else {
173
173
this .lines .add (this .destinationSupplier , level , message , t );
@@ -218,7 +218,7 @@ public void replayTo(Class<?> destination) {
218
218
public void replayTo (Log destination ) {
219
219
synchronized (this .lines ) {
220
220
for (Line line : this .lines ) {
221
- logTo ( destination , line .getLevel (), line .getMessage (), line .getThrowable ());
221
+ line .getLevel (). log ( destination , line .getMessage (), line .getThrowable ());
222
222
}
223
223
this .lines .clear ();
224
224
}
@@ -247,17 +247,6 @@ public static Log replay(Log source, Log destination) {
247
247
return destination ;
248
248
}
249
249
250
- static void logTo (Log log , LogLevel level , Object message , @ Nullable Throwable throwable ) {
251
- switch (level ) {
252
- case TRACE -> log .trace (message , throwable );
253
- case DEBUG -> log .debug (message , throwable );
254
- case INFO -> log .info (message , throwable );
255
- case WARN -> log .warn (message , throwable );
256
- case ERROR -> log .error (message , throwable );
257
- case FATAL -> log .fatal (message , throwable );
258
- }
259
- }
260
-
261
250
static class Lines implements Iterable <Line > {
262
251
263
252
private final List <Line > lines = new ArrayList <>();
0 commit comments