Debugging

what’s the preferred way to log values from SOUL to the outside world for debugging purpose? would it be to create a dummy output event and pass data to it, or is there some kind of built-in logging function?

is it possible to step through soul code using breakpoints?

We’ve not had chance to do a debugger yet! That’s quite a big task but the plan is to start working on tools like that this year.

For logging, if you have a top level output event stream that takes the ‘string’ type, and if you’re running the console app, then it’ll log that to stdout. (In fact the console app will print any kind of event output stream data to stdout, including numbers, structs, etc).

That’s a bit fiddly to set up at the moment because you have to declare a stream for it, but I have a to-do list item to add a special built-in debug stream that’s available anywhere in the code to make it easy to hack in a quick log statement

right, got it! does “top level output event stream” mean a stream that is defined on the [[main]] processor?

yep

so something like

processor Hello
{
    output event string out;

    void run()
    {
        loop
        {
            out << "Hello ";
            loop (10000) advance();
            out << "World ";
            loop (10000) advance();
        }
    }
}
1 Like