How to print debug statements in Maelstrom with Go

From the Maelstrom docs

Maelstrom nodes receive messages on STDIN, send messages on STDOUT, and log debugging output on STDERR. Maelstrom nodes must not print anything that is not a message to STDOUT. Maelstrom will log STDERR output to disk for you.

I am using fmt.Fprint(os.Stderr, "Received message: ", msg, "\n") to print to STDERR but can’t find it. Does anyone know how I can log messages to better understand the protocol?

Thank you

You can find the STDERR logs for each node under:

$MAELSTROM_DIR/store/$WORKLOAD/$TIMESTAMP/node-logs

You can also find debugging info when you run: maelstrom serve

1 Like