Read serial buffer internally

hi all,

I'm trying out something and I'm not sure if I'm on the right path.

I have a relatively large piece of code written in the Arduino IDE. Now we've added a small oled screen to the hardware.
Wondering if I'm able to 'catch' the serial debug information and display it on the screen. Through-out the code there are numerous Serial.println().

Is there a possibility to display these serial strings on the screen?
My way of thinking is that these serial prints are stored somewhere in the flash memory. If at the end of the loop I could read this memory I would at least be able to display the latest send serial information.

Or. Is there a possibility to 'loop' the serial.print to the serial.read . It must be done without a secondary device.

Maybe anyone has experience with this?

Much thanks,
Rowan

Add to (or replace) Serial.print by yourOled.print?

Serial.println(myVar);
yourOled.print(someVar);

If the text that you send to the serial port is dynamic (e.g. Serial.println(someVar) where someVar will change), it will not be in flash.

After giving it some thought its probably easiest to make a separate function ProjectPrint(someValue) and do the serial print as well as the oled print in that function. I can just search and replace all serial prints with that new function.

Thanks for thinking along sterretje!