src/Pure/General/output.scala
changeset 83265 b11587195c70
parent 80817 e31ebb2be437
child 83266 2f75f2495e3e
--- a/src/Pure/General/output.scala	Fri Oct 10 01:22:03 2025 +0200
+++ b/src/Pure/General/output.scala	Sat Oct 11 16:19:16 2025 +0200
@@ -6,6 +6,8 @@
 
 package isabelle
 
+import java.io.PrintStream
+
 
 object Output {
   def writeln_text(msg: String): String = Protocol_Message.clean_output(msg)
@@ -17,10 +19,11 @@
   def error_message_text(msg: String): String =
     error_message_prefix(Protocol_Message.clean_output(msg))
 
+  def stream(stdout: Boolean = false): PrintStream =
+    if (stdout) Console.out else Console.err
+
   def output(s: String, stdout: Boolean = false, include_empty: Boolean = false): Unit =
-    if (s.nonEmpty || include_empty) {
-      if (stdout) Console.print(s + "\n") else Console.err.print(s + "\n")
-    }
+    if (s.nonEmpty || include_empty) stream(stdout = stdout).print(s + "\n")
 
   def writeln(msg: String, stdout: Boolean = false, include_empty: Boolean = false): Unit =
     output(writeln_text(msg), stdout = stdout, include_empty = include_empty)