Debug print only with debugger

Hi,
I’m looking for a way to see debug print (printf()) like hw.PrintLine(), but without USB serial connection. Is there any way to put debug prints only with the debugger connection?