Detecting something reading port.

I suspect I know the answer to this one, but I'll ask it anyway.

Is there a way of detecting if anything is actually monitoring a serial port?

My project is full of Serial.print() statements, they're very useful for debugging during development. However, I've just realised now much time each one takes to process. When the project is running 'live' it's completely un-monitored, but all those serial.print() statements are just slowing everything down. I could set a flag somewhere to switch these serial.print() statements off, but that would rely on me re-uploading the project just before going live. Is there a programmatic way of detecting if the serial port is being monitored so I can switch of the port if it's not plugged into anything?

Yes. The something sends a bit of data.

Have you considered using a switch / jumper on an unused pin to enable / disable writing to Serial?

Yes. The something sends a bit of data.

I'm looking for away that an arduino can detect if an external device is monitoring (i.e. reading from) an arduino serial port.

I know I can detect if a serial device is sending data to an arduino, but how to detect if its reading it? (without establishing two-ways comms.)

Have you considered using a switch / jumper on an unused pin to enable / disable writing to Serial?

Yes - but that still requires me to remember to install the pin when I install the device!

I have established a work-around. My project includes voltage divider for measuring it's own supply voltage, when the project is being developed on the bench, the supply voltage is about 5volts from the USB port, when it installed and running live, it uses a 12 volt battery.

So I can detect the supply voltage, and use that to decide if all the serial.print() statements should be enabled or not.

BigusDickus:
I have established a work-around. My project includes voltage divider for measuring it's own supply voltage, when the project is being developed on the bench, the supply voltage is about 5volts from the USB port, when it installed and running live, it uses a 12 volt battery.

So I can detect the supply voltage, and use that to decide if all the serial.print() statements should be enabled or not.

I wouldn't call that a workaround. I have used that technique on a few projects. Monitoring the supply voltage is perfectly valid, and can be used for your purpose, or for other things, like warning if a battery needs replacing or recharging.