Can I pipe the Console output to std out
-
When working with External floating tile in C++, can I somehow pipe the console output that is available to the javascript to std out so I can see it in my C++ Debug output next to my std::cout ?
-
@jonhallur There's a
Console.breakInDebugger()
command but I don't see anything to forward the output of.print()
-
@d-healey Thats a great start
-
@d-healey said in Can I pipe the Console output to std out:
@jonhallur There's a
Console.breakInDebugger()
command but I don't see anything to forward the output of.print()
Unless I'm missing some compile option, running the ExternalFloatingTileTest in under Debug in VS2017 does not appear to to break.
-
@jonhallur I've never used it so perhaps it isn't designed for this use case.
-
@d-healey said in Can I pipe the Console output to std out:
@jonhallur I've never used it so perhaps it isn't designed for this use case.
It was a good idea
-
@jonhallur If you're running in the debugger, the HiseScript console output gets also printed to the VS debugger using the
DBG()
macro from JUCE.The
Console.break()
function just throws an assertion so you can inspect the C++ callstack. -
@christoph-hart said in Can I pipe the Console output to std out:
@jonhallur If you're running in the debugger, the HiseScript console output gets also printed to the VS debugger using the
DBG()
macro from JUCE.The
Console.break()
function just throws an assertion so you can inspect the C++ callstack.I of course meant the DBG output, not std out, which works fine for my C++ code, but nothing I write using Javascript Console.print shows up in my VS Output window. It only shows up when I'm running inside HiseStandalone application.
For example, I have a ScriptButton on the Hise side which when pressed prints some stuff to the JS console, which works when inside HiseStandalone application and shows up in the Hise console window under Hise code editor, but when I generate the C++ project (I am using the ExternalFloatingTileTest from the hise_tutorial project on GitHub), and run it under VS and press that same button nothing shows up in VS Output window, where I can see all my DBG lines from the C++ code.
-
@jonhallur Ah yes, you're right - it just redirects script errors to DBG in the compiled version.
Just add
DBG(x.toString())
before this line and you're good. -
@christoph-hart Thanks
-
@christoph-hart While this works for when running the Hise standalone editor, it does not appear to work when I export a Hise preset to it's own VS standalone project and build and run the debug version.
-
You're right (I keep forgetting about the layers I've added to the debug handling). All
Console.xxx()
calls are ignored in the compiled plugin (in fact they are thrown away by the HiseScript compiler when parsing the Javascript code). This is to prevent that any residual debugging code ends up clogging the finished product.You can remove this by removing everything inside this preprocessing definition: