I should be able to put "print" statements into my code
Summary: Requested by Eric, to aid in debugging.
How could we make this work? Ideally, we'd have something like a Writer Monad passed down through the QL stack, so that we get a log out at the end that works properly; however, we're not getting that any time soon.
More plausible: how about we manage this through the UserSession? Could we have a command that sends a message that stores a transient log there? We could then hook into that from the Console, with a "Print Log" command, or something like that.
Yeah, that seems to work. UserSession could simply maintain a List of prints, in reverse-chrono order. Each one would contain the actual debug String, a timestamp, and the Space it came from. We would add a new _debugMsg() command, which takes a Text parameter, and sends it over there. (Sadly side-effecting, but I'm not going to lose sleep over logging being side-effecty.) This quietly builds up transiently -- at least for now, we won't worry about persisting it -- so it should be efficient to just allow it in general. Then we add a "Show Log" command. By default it would show, say, the past five minutes' worth of messages, but it would have parameters to show all of them, or a specific length of time, or the last N messages.