@@ -166,7 +166,7 @@ public void fatal(Object message, Throwable t) {
166166 private void log (LogLevel level , Object message , Throwable t ) {
167167 synchronized (this .lines ) {
168168 if (this .destination != null ) {
169- logTo (this .destination , level , message , t );
169+ level . log (this .destination , message , t );
170170 }
171171 else {
172172 this .lines .add (this .destinationSupplier , level , message , t );
@@ -216,7 +216,7 @@ public void replayTo(Class<?> destination) {
216216 public void replayTo (Log destination ) {
217217 synchronized (this .lines ) {
218218 for (Line line : this .lines ) {
219- logTo ( destination , line .getLevel (), line .getMessage (), line .getThrowable ());
219+ line .getLevel (). log ( destination , line .getMessage (), line .getThrowable ());
220220 }
221221 this .lines .clear ();
222222 }
@@ -245,17 +245,6 @@ public static Log replay(Log source, Log destination) {
245245 return destination ;
246246 }
247247
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-
259248 static class Lines implements Iterable <Line > {
260249
261250 private final List <Line > lines = new ArrayList <>();
0 commit comments