First, you'll need netcat. That link is for the windows version, but there's also versions for *nix. Netcat runs from the command line. To listen for the DbgPrints from your channel, you use the command:
nc -L -p 6666 -w 1
The port it listens on can be anything you want; I use 6666. The -L (note: capital L) tells it to listen and not close the connection after each message ("listen harder"). The -w 1 tells it to timeout after one second. I don't think it's necessary since I use async requests in DbgPrint, but I don't think it can hurt either.
Now for DbgPrint:
Sub DbgPrint(text as String)
print "DbgPrint: ";text
' On laptop run: nc -L -p 6666 -w 1
if not m.JT then return
server = "http://192.168.0.100:6666"
port = CreateObject("roMessagePort")
xfer = CreateObject("roUrlTransfer")
I use the global m.JT in most of my channels to tell when my code is running on one of my boxes (it's set depending on the device ID from roDeviceInfo->GetDeviceUniqueId). I use it here so that I can leave this in my final code (I don't usually strip out extraneous prints) and it won't have any effect if it's not running on one of my boxes.
To use it within your code, you have to make sure you convert everything to one string first. It's helpful to combine multiple prints into one call using chr(10) to split things on different lines because netcat spits out a lot of header stuff that makes multiple prints take up a lot of screen space:
Putting multiple things in one call also speeds things up. This will slow down your code a little.
DbgPrint("x = " + x.toStr() + chr(10) + "y = " + y.toStr())
You'll want to set server to the IP address of the computer you'll be using for netcat. It would be better if it wasn't hard-coded, but I don't think I'll ever change the IP address of my development computer.
I've used other methods of POSTing back to my server and saving logs to files, but I much prefer the realtime nature of this. There's certainly plenty of room for improvement, for example you can only print strings, but this has been helpful to me and I hope it's helpful to others.