@@ -37,19 +37,19 @@ public final class Log {
3737 /** The lowest level that should be logged. If {@code null}, all logging is completely disabled. */
3838 public static @ Nullable Level enabled = Level .INFO ;
3939
40- public static final PrintStream EMPTY = EmptyPrintStream . INSTANCE ;
40+ public static final PrintStream EMPTY = DelegatePrintStream . EMPTY ;
4141 /** The stream used for {@link Level#DEBUG}. */
42- public static final PrintStream DEBUG = CapturingPrintStream . of (Level .DEBUG , System .out :: println );
42+ public static final PrintStream DEBUG = new DelegatePrintStream . Capturing (Level .DEBUG , System .out );
4343 /** The stream used for {@link Level#QUIET}. */
44- public static final PrintStream QUIET = CapturingPrintStream . of (Level .QUIET , System .out :: println );
44+ public static final PrintStream QUIET = new DelegatePrintStream . Capturing (Level .QUIET , System .out );
4545 /** The stream used for {@link Level#INFO}. */
46- public static final PrintStream INFO = CapturingPrintStream . of (Level .INFO , System .out :: println );
46+ public static final PrintStream INFO = new DelegatePrintStream . Capturing (Level .INFO , System .out );
4747 /** The stream used for {@link Level#WARN}. */
48- public static final PrintStream WARN = CapturingPrintStream . of (Level .WARN , System .out :: println );
48+ public static final PrintStream WARN = new DelegatePrintStream . Capturing (Level .WARN , System .out );
4949 /** The stream used for {@link Level#ERROR}. */
50- public static final PrintStream ERROR = CapturingPrintStream . of (Level .ERROR , System .err :: println );
50+ public static final PrintStream ERROR = new DelegatePrintStream . Capturing (Level .ERROR , System .err );
5151 /** The stream used for {@link Level#FATAL}. */
52- public static final PrintStream FATAL = CapturingPrintStream . of (Level .FATAL , System .err :: println );
52+ public static final PrintStream FATAL = new DelegatePrintStream . Capturing (Level .FATAL , System .err );
5353
5454
5555 /* INDENTATIONS */
@@ -104,10 +104,10 @@ private static String getIndentation(byte indent) {
104104 static @ UnknownNullability List <CapturedMessage > CAPTURED ;
105105
106106 private static final class CapturedMessage {
107- private final Log . Level level ;
107+ private final Level level ;
108108 private final String message ;
109109
110- private CapturedMessage (Log . Level level , String message ) {
110+ private CapturedMessage (Level level , String message ) {
111111 this .level = level ;
112112 this .message = message ;
113113 }
@@ -134,7 +134,7 @@ public static void capture() {
134134 CAPTURED = new ArrayList <>(128 );
135135 }
136136
137- static void tryCapture (Consumer <String > logger , Log . Level level , String message ) {
137+ static void tryCapture (Consumer <String > logger , Level level , String message ) {
138138 if (CAPTURED != null )
139139 CAPTURED .add (new CapturedMessage (level , message ));
140140 else
@@ -157,7 +157,7 @@ public static void drop() {
157157 * @see #release(BiConsumer)
158158 */
159159 public static void release () {
160- release (Log ::logInternal );
160+ release (Log ::logCaptured );
161161 }
162162
163163 /**
@@ -166,7 +166,7 @@ public static void release() {
166166 * @param consumer The consumer to release the captured log messages to
167167 * @see #capture()
168168 */
169- public static void release (BiConsumer <Log . Level , String > consumer ) {
169+ public static void release (BiConsumer <Level , String > consumer ) {
170170 if (CAPTURED == null ) return ;
171171
172172 Iterator <CapturedMessage > itor = CAPTURED .iterator ();
@@ -178,8 +178,8 @@ public static void release(BiConsumer<Log.Level, String> consumer) {
178178 }
179179
180180 // so we can use a method reference instead of allocate a lambda
181- private static void logInternal (Level level , String message ) {
182- Log .log (level , message );
181+ private static void logCaptured (Level level , String message ) {
182+ (( DelegatePrintStream ) Log .getLog (level )). getDelegate (). println ( message );
183183 }
184184
185185
0 commit comments