optional trace output;
authorwenzelm
Fri, 06 Sep 2019 20:23:31 +0200
changeset 70666 e56ec28fc5e8
parent 70665 94442fce40a5
child 70667 3cab8dad5b40
optional trace output;
src/Pure/PIDE/prover.scala
--- a/src/Pure/PIDE/prover.scala	Fri Sep 06 19:44:54 2019 +0200
+++ b/src/Pure/PIDE/prover.scala	Fri Sep 06 20:23:31 2019 +0200
@@ -341,9 +341,17 @@
 
   /** protocol commands **/
 
+  var trace: Boolean = false
+
   def protocol_command_raw(name: String, args: List[Bytes]): Unit =
     command_input match {
-      case Some(thread) if thread.is_active => thread.send(Bytes(name) :: args)
+      case Some(thread) if thread.is_active =>
+        if (trace) {
+          val payload = (0 /: args)({ case (n, b) => n + b.length })
+          Output.writeln(
+            "protocol_command " + name + ", args = " + args.length + ", payload = " + payload)
+        }
+        thread.send(Bytes(name) :: args)
       case _ => error("Inactive prover input thread for command " + quote(name))
     }