I occasionally want to collect console output from the PlaydateSimulator (or from the physical Playdate when running connected to the PlaydateSimulator). I can copy and paste out of the Console window, but it would often be easier to just redirect it into a file or have it visible in my terminal even the the simulator is blocking on my program.
As I imagine somethings this is an absolute firehose, I would understand not wanting to make this the default. But something like --console-to-stdout would be nifty.
What platform are you on? It does copy to stdout on macOS: If you launch the simulator from Terminal.app you'll see everything that prints on the console in the terminal as well. If it doesn't do that on Windows or Linux we need to fix that.
So print(...) should be emitting to stdout? It isn't on my system (SDK 1.12.3 on Ubuntu 20.04).
Running the following, I get the given output in my terminal. Nothing is emitted past "Loading: OK". (I added blank lines between commands for clarity.)
$ ls src
main.lua
$ cat src/main.lua
function playdate.update()
print(playdate.getCurrentTimeMilliseconds())
end
$ rm -rf out.pdx
$ pdc --version
1.12.3
$ pdc src out.pdx
$ PlaydateSimulator out.pdx
14:01:41: Debug: SimulatorApp::OnInit()
14:01:41: Logging started [2022-08-18T14:01:41]
14:01:41: Logging to [/home/chaos/.Playdate Simulator/Playdate Simulator.log]
14:01:42: SDK: /opt/PlaydateSDK-1.12.3
14:01:42: Release: 1.12.3
14:01:43: cmd line pdx path: out.pdx
14:01:43: Loading: out.pdx
14:01:43: Loading: OK
Meanwhile, the Playdate Console window (View > Show Debug Console) is the firehose I expect:
Information about the Simulator (as opposed to the app) is displayed, sometimes in both channels. For example, I paused my app, plugged in my Playdate, unlocked it, found myself in the Settings app, and locked it.
Output to window:
14:06:11: Device Connected: /dev/ttyACM0
14:06:11: PlaydateSerialOpen (/dev/ttyACM0)
14:06:11: SerialReadThread::Entry
echo off
~version:
target=DVT1
build=59185ded27c7-1.12.3-release.140884-buildbot-20220811_165705
boot_build=59185ded27c7-1.12.3-release.140884-buildbot
SDK=1.12.3
pdxversion=11200
serial#=PDU1-Y007110
cc=9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
time and date set
14:06:26: Device Disconnected: /dev/ttyACM0
14:06:26: PlaydateSerialClose (31)
14:06:26: SerialReadThread OnExit