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