Echoing post window output to a text file?

Is there a simple way of echoing any and all output to the post window, so that it is also written to a specified text file? and if so, a way of turning this on and off?

You can. It’s less easy and there are pitfalls.

If you want to do this, you can override the core post methods in String. You can start with an extension like this:

+String {
	postln {
		// do my custom stuff
	post {
		// do my custom stuff
	prPostln {
	prPost {

If you e.g. added a file write to these, then your problem will be… sorta solved. This should get you MOST post messages. It will not capture messages from the Server, since these don’t go through post. There are also some edge case places where primitives print directly to the standard out - you would not capture these either.

If you mainly care about your OWN code, and want something more like logging functionality, you can use the Log quark (Quarks.install("").

Then you can do:

~log = File("~/Desktop/log.txt".standardizePath, "w");
	~log.write("[% - %] %\n".format(

Log(\test2).error("Uh oh error");
Log(\test2).info("This is just some info");