JAndrassy/TelnetStream

'Overload' Serial.print and TelnetStream.print and others

Closed this issue · 2 comments

This is not an issue but a question:

Is it possible to make a function that both outputs Serial.print and telnetStream.print (and the others, like printnl() and printf() etc).
I now have to program for both outputs e.g.

Serial.print("foobar");
telnetStream.print("foobar");

and
Serial.printf("%i", integervalue);
telnetStream.printf("%i", integervalue);

To keep the code simple and readable I'd like to combine the two output commands to e.g.

message.print("foobar");
message.printf("%i", some integer);

At which the output ("foobar") is both printed to the serial output as to the telnet client.

Thanks.

I am back again at this question. Please elaborate. The examples do not help me much. I just want a 'tee' from the Serial.print statement/telnet.print statement.